Re:[Quantproject-developers] Re: [Quantproject-developers] QuantProject/b7_Scripts/TickerSelection
Brought to you by:
glauco_1
|
From: marco\.milletti\@l <mar...@li...> - 2005-02-28 13:44:16
|
> > Millo, > > per permettermi di provare lo script qua da me, per f= avore, vedi se puoi > renderlo quanto piu' possibile indipendente dal t= uo stato locale. Intendo: > - portare tutti i parametri dello script in = un punto solo (indice di > riferimento, data iniziale, data finale, eve= ntuali altri; magari passati al > costruttore del RunEfficientCTOPortfo= lio ... ) > - evitare, se possibile, riferimenti a path sul tuo PC (o, m= agari, portare > anche quello come parametro ben "isolato") Sapevo c= he me l'avresti chiesto ... porca zoccola, bisognerebbe aver pi=F9 tempo = ... Mi sembrava pi=F9 urgente sistemare il TickerSelector e dintorni. An= che perch=E8 tra un po' scriver=F2 la classe per fare la selezione sui ti= cker con un prezzo compreso in un certo intervallo. Adesso ho xp pro i= n ufficio su un pentium 4 da 2.66 con 504 MB di RAM. Tra un po' sar=F2 o= perativo anche qui. > At 07:56 PM 2/27/2005 +0000, you wrote: > >Upda= te of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTestin= g > >In directory > >sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4614/b7_= Scripts/TickerSelectionTesting > > > >Modified Files: > > EndO= fDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTO.cs > > GenomeMana= gerForEfficientCTOPortfolio.cs > > RunEfficientCTOPortfolio.cs=0D = > >Log Message: > >Advanced Ticker selection has been re-organized in a = more rational and > >object-oriented way > >(NOTE that at the moment Q= uantdownloader solution won't compile) > > > >Index: EndOfDayTimerHandl= erCTO.cs > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >RC= S file: > >/cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectio= nTesting/EndOfDayTimerHandlerCTO.cs,v > >retrieving revision 1.3 > >ret= rieving revision 1.4 > >diff -C2 -d -r1.3 -r1.4 > >*** EndOfDayTimerHan= dlerCTO.cs 12 Feb 2005 19:16:46 -0000 1.3 > >--- EndOfDayTimerHand= lerCTO.cs 27 Feb 2005 19:56:08 -0000 1.4 > >*************** > >**= * 94,98 **** > > long quantity =3D > > Convert.ToInt6= 4( Math.Floor( cashForSinglePosition / > > this.account.DataStreamer.Ge= tCurrentBid( ticker ) ) ); > >! Order order =3D new Order( OrderTy= pe.MarketBuy, new Instrument( > >ticker ) , quantity ); > > th= is.orders.Add(order); > > } > >--- 94,98 ---- > > long q= uantity =3D > > Convert.ToInt64( Math.Floor( cashForSinglePosi= tion / > > this.account.DataStreamer.GetCurrentBid( ticker ) ) ); > >!= Order order =3D new Order( OrderType.MarketSellShort, new > >Ins= trument( ticker ) , quantity ); > > this.orders.Add(order); > >= } > >*************** > >*** 126,130 **** > > { > > = if(this.orders.Count =3D=3D 0 && this.account.Transactions.Count =3D=3D= 0) > >! this.account.AddCash(15000); > > > > this.mar= ketOpenEventHandler_orderChosenTickers(); > >--- 126,130 ---- > > = { > > if(this.orders.Count =3D=3D 0 && this.account.Transaction= s.Count =3D=3D 0) > >! this.account.AddCash(30000); > > > > = this.marketOpenEventHandler_orderChosenTickers(); > >*************= ** > >*** 172,184 **** > > private DataTable getSetOfTickersToBeO= ptimized(DateTime currentDate) > > { > >! TickerSelector mo= stLiquid =3D new > >TickerSelector(SelectionType.Liquidity, > >! = false, this.tickerGroupID , > >currentDate.AddDays(-this.numDaysForL= iquidity), currentDate, > >this.numberOfEligibleTickers); > > = this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers(); > >! = TickerSelector quotedInEachMarketDayFromMostLiquid =3D > >! = new TickerSelector( this.eligibleTickers, > >! SelectionType.Quo= tedInEachMarketDay, false, "", > >! currentDate.AddDays(-this.nu= mDaysForLiquidity),currentDate, > >! this.numberOfEligibleTicker= s); > >! quotedInEachMarketDayFromMostLiquid.MarketIndex =3D "^MIB= TEL"; > > return > > quotedInEachMarketDayFromMostLiquid.GetTa= bleOfSelectedTickers(); > > } > >--- 172,182 ---- > > priv= ate DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > > = { > >! SelectorByLiquidity mostLiquid =3D new > >SelectorByLi= quidity(this.tickerGroupID, false, > >! > >currentDate.AddDays(-this.n= umDaysForLiquidity), currentDate, > >this.numberOfEligibleTickers); > = > this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers()= ; > >! SelectorByQuotationAtEachMarketDay > >quotedInEachMarketD= ayFromMostLiquid =3D > >! new SelectorByQuotationAtEachMarketDay= ( this.eligibleTickers, > >! false, =0D = > >currentDate.AddDays(-this.numDaysForLiquidity), > >! = currentDate, > >this.numberOfEligibleTickers, "^MIB= TEL"); > > return > > quotedInEachMarketDayFromMostLiquid.GetT= ableOfSelectedTickers(); > > } > > > >Index: GenomeManagerForEff= icientCTOPortfolio.cs > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > >RCS file: > >/cvsroot/quantproject/QuantProject/b7_Scripts/Tick= erSelectionTesting/GenomeManagerForEfficientCTOPortfolio.cs,v > >retriev= ing revision 1.4 > >retrieving revision 1.5 > >diff -C2 -d -r1.4 -r1.5=0D = > >*** GenomeManagerForEfficientCTOPortfolio.cs 6 Feb 2005 20:14:01 =0D = > >-0000 1.4 > >--- GenomeManagerForEfficientCTOPortfolio.cs 27= Feb 2005 19:56:08 > >-0000 1.5 > >*************** > >*** 95,98 = **** > >--- 95,115 ---- > > return returnValue; > > }=0D = > >+ > >+ public override double GetFitnessValue(Genome genome) > >= + { > >+ double returnValue; > >+ double portfolioVaria= nce =3D this.getPortfolioVariance(genome.Genes()); > >+ double por= tfolioRateOfReturn =3D > >this.getPortfolioRateOfReturn(genome.Genes())= ; > >+ this.variance =3D portfolioVariance; > >+ this.rateO= fReturn =3D portfolioRateOfReturn; > >+ > >+ NormalDistribution n= ormal =3D new > >NormalDistribution(portfolioRateOfReturn, Math.Sqrt(po= rtfolioVariance)); > >+ //for long portfolio > >+ //returnV= alue =3D > >normal.GetProbability(this.targetPerformance*0.75,this.targ= etPerformance*1.25); > >+ //for short portfolio > >+ return= Value =3D > >normal.GetProbability(-this.targetPerformance*1.25,-this.t= argetPerformance*0.75); > >+ //returnValue =3D 1 - normal.GetProba= bility(this.targetPerformance); > >+ return returnValue; > >+ = } > > > > } > > > >Index: EndOfDayTimerHandlerCTC.cs > >=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >RCS file: > >/cvsroot/qu= antproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHa= ndlerCTC.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 1= 9:56:08 -0000 1.2 > >*************** > >*** 88,100 **** > > = private DataTable getSetOfTickersToBeOptimized(DateTime currentDate) > = > { > >! TickerSelector mostLiquid =3D new > >TickerSelect= or(SelectionType.Liquidity, > >! false, this.tickerGroupID , cur= rentDate.AddDays(-90), > >currentDate, this.numberOfEligibleTickers);=0D = > > this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers= (); > >! TickerSelector quotedInEachMarketDayFromMostLiquid =3D=0D = > >! new TickerSelector( this.eligibleTickers, > >! Sele= ctionType.QuotedInEachMarketDay, false, "", > >! currentDate.Add= Days(-90),currentDate, > >! this.numberOfEligibleTickers); > >!= quotedInEachMarketDayFromMostLiquid.MarketIndex =3D "^MIBTEL"; > = > return > > quotedInEachMarketDayFromMostLiquid.GetTableOfSele= ctedTickers(); > > } > >--- 88,98 ---- > > private DataTab= le getSetOfTickersToBeOptimized(DateTime currentDate) > > { > >! = SelectorByLiquidity mostLiquid =3D new > >SelectorByLiquidity(thi= s.tickerGroupID,false, > >! curren= tDate.AddDays(-90), > >currentDate, this.numberOfEligibleTickers); > >= this.eligibleTickers =3D mostLiquid.GetTableOfSelectedTickers();= > >! SelectorByQuotationAtEachMarketDay > >quotedInEachMarketDa= yFromMostLiquid =3D > >! new SelectorByQuotationAtEachMarketDay(= this.eligibleTickers, > >! false, > = >currentDate.AddDays(-90),currentDate, > >! = this.numberOfEligibleTickers, "^MIBTEL"); > > return > >= quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); > > = } > > > >Index: RunEfficientCTOPortfolio.cs > >=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >RCS file: > >/cvsroot/quantproject/Q= uantProject/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:3= 6 -0000 1.13 > >--- RunEfficientCTOPortfolio.cs 27 Feb 2005 19:56:0= 8 -0000 1.14 > >*************** > >*** 36,39 **** > >--- 36,40 --= -- > > using QuantProject.Business.Testing; > > using QuantProject.= Business.Timing; > >+ using QuantProject.Business.Financial.Accounting.C= ommissions; > > using QuantProject.Data.DataProviders; > > using Qu= antProject.Data.Selectors; > >*************** > >*** 98,104 **** > > = this.reportTable =3D new ReportTable( "Summary_Reports" ); > > = this.startDateTime =3D new EndOfDayDateTime( > >! new Date= Time( 2004 , 1 , 1 ) , > >EndOfDaySpecificTime.FiveMinutesBeforeMarketC= lose ); > > this.endDateTime =3D new EndOfDayDateTime( > >! = new DateTime( 2004 , 1 , 10 ) , > >EndOfDaySpecificTime.OneHourAft= erMarketClose ); > > //this.numIntervalDays =3D 3; > > = } > >--- 99,105 ---- > > this.reportTable =3D new Repor= tTable( "Summary_Reports" ); > > this.startDateTime =3D new EndO= fDayDateTime( > >! new DateTime( 2004 , 9 , 1 ) , > >EndOfDayS= pecificTime.FiveMinutesBeforeMarketClose ); > > this.endDateTime= =3D new EndOfDayDateTime( > >! new DateTime( 2004 , 9 , 10 ) , = > >EndOfDaySpecificTime.OneHourAfterMarketClose ); > > //this.= numIntervalDays =3D 3; > > } > >*************** > >***= 109,113 **** > > { > > //"STOCKMI" > >! TickerSel= ector mostLiquid =3D new > >TickerSelector(SelectionType.Liquidity, > = > false, "STOCKMI",= > > firstDate, lastDate, 70); > > DataTable tickers =3D mostL= iquid.GetTableOfSelectedTickers(); > >--- 110,115 ---- > > { > >= //"STOCKMI" > >! /* > >! * SelectorByLiquidity mo= stLiquid =3D new > >TickerSelector(SelectionType.Liquidity, > > = false, "STOCKMI", > > f= irstDate, lastDate, 70); > > DataTable tickers =3D mostLiquid.Ge= tTableOfSelectedTickers(); > >*************** > >*** 123,126 **** > >-= -- 125,130 ---- > > System.Console.WriteLine("\n\nThe best solut= ion found is: " + > > (string)GO.BestGenome.Meaning + > > " = with {0} generations", GO.GenerationCounter); > >+ */ > >+ = ; > > } > > > >*************** > >*** 136,140 ****=0D = > > this.historicalQuoteProvider = ) , > > new HistoricalEndOfDayOrderExecutor( this.endOfDayTime= r , > >! this.historicalQuoteProvi= der ) ); > > > > } > >--- 140,144 ---- > > = this.historicalQuoteProvider ) , > > new H= istoricalEndOfDayOrderExecutor( 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://a= ds.osdn.com/?ad_id=3D6595&alloc_id=3D14396&op=3Dclick > >_______________= ________________________________ > >Quantproject-developers mailing list= > >Qua...@li... > >https://lists.sour= ceforge.net/lists/listinfo/quantproject-developers > > > > -------= ------------------------------------------------ > 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=3D6595&alloc_= id=3D14396&op=3Dclick > _______________________________________________=0D = > Quantproject-developers mailing list > Quantproject-developers@lists.s= ourceforge.net > https://lists.sourceforge.net/lists/listinfo/quantproje= ct-developers > =0A=0A=0A=0A____________________________________________= ________________=0ANavighi a 2 MEGA e i primi 3 mesi sono GRATIS. =0ASceg= li Libero Adsl Flat senza limiti su http://www.libero.it=0A |