[Quantproject-developers] Re: [Quantproject-developers] QuantProject/b7_Scripts/TickerSelectionTest
Brought to you by:
glauco_1
|
From: Glauco S. <gl...@my...> - 2005-02-27 23:20:39
|
Millo, per permettermi di provare lo script qua da me, per favore, vedi se puoi renderlo quanto piu' possibile indipendente dal tuo stato locale. Intendo: - portare tutti i parametri dello script in un punto solo (indice di riferimento, data iniziale, data finale, eventuali altri; magari passati al costruttore del RunEfficientCTOPortfolio ... ) - evitare, se possibile, riferimenti a path sul tuo PC (o, magari, portare anche quello come parametro ben "isolato") At 07:56 PM 2/27/2005 +0000, you wrote: >Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting >In directory >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b7_Scripts/TickerSelectionTesting > >Modified Files: > EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs > GenomeManagerForEfficientCTOPortfolio.cs > RunEfficientCTOPortfolio.cs >Log Message: >Advanced Ticker selection has been re-organized in a more rational and >object-oriented way >(NOTE that at the moment Quantdownloader solution won't compile) > >Index: EndOfDayTimerHandlerCTO.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v >retrieving revision 1.3 >retrieving revision 1.4 >diff -C2 -d -r1.3 -r1.4 >*** EndOfDayTimerHandlerCTO.cs 12 Feb 2005 19:16:46 -0000 1.3 >--- EndOfDayTimerHandlerCTO.cs 27 Feb 2005 19:56:08 -0000 1.4 >*************** >*** 94,98 **** > long quantity = > Convert.ToInt64( Math.Floor( cashForSinglePosition / > this.account.DataStreamer.GetCurrentBid( ticker ) ) ); >! Order order = new Order( OrderType.MarketBuy, new Instrument( >ticker ) , quantity ); > this.orders.Add(order); > } >--- 94,98 ---- > long quantity = > Convert.ToInt64( Math.Floor( cashForSinglePosition / > this.account.DataStreamer.GetCurrentBid( ticker ) ) ); >! Order order = new Order( OrderType.MarketSellShort, new >Instrument( ticker ) , quantity ); > this.orders.Add(order); > } >*************** >*** 126,130 **** > { > if(this.orders.Count == 0 && this.account.Transactions.Count == 0) >! this.account.AddCash(15000); > > this.marketOpenEventHandler_orderChosenTickers(); >--- 126,130 ---- > { > if(this.orders.Count == 0 && this.account.Transactions.Count == 0) >! this.account.AddCash(30000); > > this.marketOpenEventHandler_orderChosenTickers(); >*************** >*** 172,184 **** > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! TickerSelector mostLiquid = new >TickerSelector(SelectionType.Liquidity, >! false, this.tickerGroupID , >currentDate.AddDays(-this.numDaysForLiquidity), currentDate, >this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! TickerSelector quotedInEachMarketDayFromMostLiquid = >! new TickerSelector( this.eligibleTickers, >! SelectionType.QuotedInEachMarketDay, false, "", >! currentDate.AddDays(-this.numDaysForLiquidity),currentDate, >! this.numberOfEligibleTickers); >! quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } >--- 172,182 ---- > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! SelectorByLiquidity mostLiquid = new >SelectorByLiquidity(this.tickerGroupID, false, >! >currentDate.AddDays(-this.numDaysForLiquidity), currentDate, >this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! SelectorByQuotationAtEachMarketDay >quotedInEachMarketDayFromMostLiquid = >! new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, >! false, >currentDate.AddDays(-this.numDaysForLiquidity), >! currentDate, >this.numberOfEligibleTickers, "^MIBTEL"); > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } > >Index: GenomeManagerForEfficientCTOPortfolio.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v >retrieving revision 1.4 >retrieving revision 1.5 >diff -C2 -d -r1.4 -r1.5 >*** GenomeManagerForEfficientCTOPortfolio.cs 6 Feb 2005 20:14:01 >-0000 1.4 >--- GenomeManagerForEfficientCTOPortfolio.cs 27 Feb 2005 19:56:08 >-0000 1.5 >*************** >*** 95,98 **** >--- 95,115 ---- > return returnValue; > } >+ >+ public override double GetFitnessValue(Genome genome) >+ { >+ double returnValue; >+ double portfolioVariance = this.getPortfolioVariance(genome.Genes()); >+ double portfolioRateOfReturn = >this.getPortfolioRateOfReturn(genome.Genes()); >+ this.variance = portfolioVariance; >+ this.rateOfReturn = portfolioRateOfReturn; >+ >+ NormalDistribution normal = new >NormalDistribution(portfolioRateOfReturn, Math.Sqrt(portfolioVariance)); >+ //for long portfolio >+ //returnValue = >normal.GetProbability(this.targetPerformance*0.75,this.targetPerformance*1.25); >+ //for short portfolio >+ returnValue = >normal.GetProbability(-this.targetPerformance*1.25,-this.targetPerformance*0.75); >+ //returnValue = 1 - normal.GetProbability(this.targetPerformance); >+ return returnValue; >+ } > > } > >Index: EndOfDayTimerHandlerCTC.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v >retrieving revision 1.1 >retrieving revision 1.2 >diff -C2 -d -r1.1 -r1.2 >*** EndOfDayTimerHandlerCTC.cs 30 Jan 2005 19:53:12 -0000 1.1 >--- EndOfDayTimerHandlerCTC.cs 27 Feb 2005 19:56:08 -0000 1.2 >*************** >*** 88,100 **** > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! TickerSelector mostLiquid = new >TickerSelector(SelectionType.Liquidity, >! false, this.tickerGroupID , currentDate.AddDays(-90), >currentDate, this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! TickerSelector quotedInEachMarketDayFromMostLiquid = >! new TickerSelector( this.eligibleTickers, >! SelectionType.QuotedInEachMarketDay, false, "", >! currentDate.AddDays(-90),currentDate, >! this.numberOfEligibleTickers); >! quotedInEachMarketDayFromMostLiquid.MarketIndex = "^MIBTEL"; > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } >--- 88,98 ---- > private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > { >! SelectorByLiquidity mostLiquid = new >SelectorByLiquidity(this.tickerGroupID,false, >! currentDate.AddDays(-90), >currentDate, this.numberOfEligibleTickers); > this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); >! SelectorByQuotationAtEachMarketDay >quotedInEachMarketDayFromMostLiquid = >! new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, >! false, >currentDate.AddDays(-90),currentDate, >! this.numberOfEligibleTickers, "^MIBTEL"); > return > quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > } > >Index: RunEfficientCTOPortfolio.cs >=================================================================== >RCS file: >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v >retrieving revision 1.13 >retrieving revision 1.14 >diff -C2 -d -r1.13 -r1.14 >*** RunEfficientCTOPortfolio.cs 15 Feb 2005 19:15:36 -0000 1.13 >--- RunEfficientCTOPortfolio.cs 27 Feb 2005 19:56:08 -0000 1.14 >*************** >*** 36,39 **** >--- 36,40 ---- > using QuantProject.Business.Testing; > using QuantProject.Business.Timing; >+ using QuantProject.Business.Financial.Accounting.Commissions; > using QuantProject.Data.DataProviders; > using QuantProject.Data.Selectors; >*************** >*** 98,104 **** > this.reportTable = new ReportTable( "Summary_Reports" ); > this.startDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 1 , 1 ) , >EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); > this.endDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 1 , 10 ) , >EndOfDaySpecificTime.OneHourAfterMarketClose ); > //this.numIntervalDays = 3; > } >--- 99,105 ---- > this.reportTable = new ReportTable( "Summary_Reports" ); > this.startDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 9 , 1 ) , >EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); > this.endDateTime = new EndOfDayDateTime( >! new DateTime( 2004 , 9 , 10 ) , >EndOfDaySpecificTime.OneHourAfterMarketClose ); > //this.numIntervalDays = 3; > } >*************** >*** 109,113 **** > { > //"STOCKMI" >! TickerSelector mostLiquid = new >TickerSelector(SelectionType.Liquidity, > false, "STOCKMI", > firstDate, lastDate, 70); > DataTable tickers = mostLiquid.GetTableOfSelectedTickers(); >--- 110,115 ---- > { > //"STOCKMI" >! /* >! * SelectorByLiquidity mostLiquid = new >TickerSelector(SelectionType.Liquidity, > false, "STOCKMI", > firstDate, lastDate, 70); > DataTable tickers = mostLiquid.GetTableOfSelectedTickers(); >*************** >*** 123,126 **** >--- 125,130 ---- > System.Console.WriteLine("\n\nThe best solution found is: " + > (string)GO.BestGenome.Meaning + > " with {0} generations", GO.GenerationCounter); >+ */ >+ ; > } > >*************** >*** 136,140 **** > this.historicalQuoteProvider ) , > new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , >! this.historicalQuoteProvider ) ); > > } >--- 140,144 ---- > this.historicalQuoteProvider ) , > new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , >! this.historicalQuoteProvider )); > > } > > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from real users. >Discover which products truly live up to the hype. Start reading now. >http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >_______________________________________________ >Quantproject-developers mailing list >Qua...@li... >https://lists.sourceforge.net/lists/listinfo/quantproject-developers |