quantproject-developers Mailing List for QuantProject (Page 100)
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: Marco M. <mi...@us...> - 2005-09-27 22:30:06
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10794/b7_Scripts/TickerSelectionTesting Added Files: EndOfDayTimerHandlerCTOMultiAccount.cs RunEfficientCTOPortfolioMultiAccount.cs Log Message: Added MultiAccount script for the open to close strategy. --- NEW FILE: EndOfDayTimerHandlerCTOMultiAccount.cs --- /* QuantProject - Quantitative Finance Library EndOfDayTimerHandlerCTOMultiAccount.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.Data; using System.Collections; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Timing; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; using QuantProject.ADT.Optimizing.Genetic; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// Implements MarketOpenEventHandler, /// TwoMinutesBeforeMarketCloseEventHandler and OneHourAfterMarketCloseEventHandler /// These handlers contain the core strategy for the efficient close to open portfolio! /// </summary> [Serializable] public class EndOfDayTimerHandlerCTOMultiAccount : EndOfDayTimerHandler { protected int numDaysBetweenEachOptimization; private int numDaysElapsedSinceLastOptimization; protected int seedForRandomGenerator; private string[,] chosenTickersForAccounts; private int distanceForEachGenomeToTest; private Account[] accounts; private ArrayList[] ordersForAccounts; private string[,] lastOrderedTickersForAccounts; public EndOfDayTimerHandlerCTOMultiAccount(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account[] accounts, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, double targetReturn, PortfolioType portfolioType, int numDaysBetweenEachOptimization, int numberOfAccounts, int distanceForEachGenomeToTest): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForOptimizationPeriod, accounts[0], generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, targetReturn, portfolioType) { this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; this.numDaysElapsedSinceLastOptimization = 0; this.seedForRandomGenerator = ConstantsProvider.SeedForRandomGenerator; this.chosenTickersForAccounts = new string[numberOfAccounts,numberOfTickersToBeChosen]; this.lastOrderedTickersForAccounts = new string[numberOfAccounts,numberOfTickersToBeChosen]; this.ordersForAccounts = new ArrayList[numberOfAccounts]; for(int i = 0; i<numberOfAccounts;i++) ordersForAccounts[i] = new ArrayList(); this.distanceForEachGenomeToTest = distanceForEachGenomeToTest; this.accounts = accounts; } private void addOrderForTickerForEachAccount(int accountNumber, string ticker ) { string tickerCode = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); double cashForSinglePosition = this.accounts[accountNumber].CashAmount / this.numberOfTickersToBeChosen; long quantity = Convert.ToInt64( Math.Floor( cashForSinglePosition / this.accounts[accountNumber].DataStreamer.GetCurrentBid( tickerCode ) ) ); Order order; if(this.portfolioType == PortfolioType.OnlyShort || (this.portfolioType == PortfolioType.ShortAndLong && ticker != tickerCode)) order = new Order( OrderType.MarketSellShort, new Instrument( tickerCode ) , quantity ); else order = new Order( OrderType.MarketBuy, new Instrument( tickerCode ) , quantity ); this.ordersForAccounts[accountNumber].Add(order); } protected override void addChosenTickersToOrderList() { for(int i = 0; i<this.accounts.Length; i++) { for(int j = 0; j<this.numberOfTickersToBeChosen; j++) { string ticker = this.chosenTickersForAccounts[i,j]; if( ticker != null) { this.addOrderForTickerForEachAccount(i, ticker ); this.lastOrderedTickersForAccounts[i,j] = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); } } } } protected override void openPositions() { //add cash first for(int i = 0; i<this.accounts.Length; i++) { if(this.ordersForAccounts[i].Count == 0 && this.accounts[i].Transactions.Count == 0) this.accounts[i].AddCash(17000); } this.addChosenTickersToOrderList(); //execute orders actually for(int i = 0; i<this.accounts.Length; i++) { foreach(object item in this.ordersForAccounts[i]) this.accounts[i].AddOrder((Order)item); } } private void closePositions_closePositionForAccount(int accountNumber, string ticker) { this.accounts[accountNumber].ClosePosition(ticker); } protected override void closePositions() { string ticker; for(int i = 0; i<this.accounts.Length; i++) { for(int j = 0; j<this.numberOfTickersToBeChosen; j++) { ticker = this.lastOrderedTickersForAccounts[i,j]; if( ticker != null) { if(this.accounts[i].Portfolio[ticker]!=null) closePositions_closePositionForAccount(i, ticker ); } } } } /// <summary> /// Handles a "Market Open" event. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public override void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { //temporarily the if condition //if(this.numDaysElapsedSinceLastOptimization == 0) this.openPositions(); } public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { //temporarily //if(this.numDaysElapsedSinceLastOptimization == // this.numDaysBetweenEachOptimization) this.closePositions(); } #region OneHourAfterMarketCloseEventHandler protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { /* SelectorByAverageRawOpenPrice selectorByOpenPrice = new SelectorByAverageRawOpenPrice(this.tickerGroupID, false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.minPriceForMinimumCommission, this.maxPriceForMinimumCommission, 0, 2); DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers(); */ SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, currentDate); SelectorByOpenCloseCorrelationToBenchmark lessCorrelatedFromTemporizedGroup = new SelectorByOpenCloseCorrelationToBenchmark(temporizedGroup.GetTableOfSelectedTickers(), this.benchmark,true, currentDate.AddDays(-this.numDaysForOptimizationPeriod ), currentDate, this.numberOfEligibleTickers); this.eligibleTickers = lessCorrelatedFromTemporizedGroup.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = // new SelectorByWinningOpenToClose(quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(), // false, currentDate.AddDays(-2), // currentDate, this.numberOfEligibleTickers/4); //return winners.GetTableOfSelectedTickers(); //SelectorByOpenCloseCorrelationToBenchmark lessCorrelated = // new SelectorByOpenCloseCorrelationToBenchmark(quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(), // this.benchmark, true, // currentDate.AddDays(-this.numDaysForLiquidity), // currentDate, this.numberOfEligibleTickers/2); return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); //return lessCorrelated.GetTableOfSelectedTickers(); } protected virtual void setTickers(DateTime currentDate, bool setGenomeCounter) { DataTable setOfTickersToBeOptimized = this.getSetOfTickersToBeOptimized(currentDate); if(setOfTickersToBeOptimized.Rows.Count > this.chosenTickers.Length*2) //the optimization process is possible only if the initial set of tickers is //as large as the number of tickers to be chosen { IGenomeManager genManEfficientCTOPortfolio = new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, this.targetReturn, this.portfolioType); GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio, this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, this.seedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); GO.Run(false); //this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), // currentDate); for(int i = 0; i<this.accounts.Length; i++) { for(int j = 0; j<this.numberOfTickersToBeChosen; j++) this.chosenTickersForAccounts[i,j] = ((string[])((Genome)GO.CurrentGeneration[GO.CurrentGeneration.Count - 1 -i*this.distanceForEachGenomeToTest]).Meaning)[j]; } } //else it will be buyed again the previous optimized portfolio //that's it the actual chosenTickers member } protected void oneHourAfterMarketCloseEventHandler_updatePrices() { //min price for minimizing commission amount //according to IB Broker's commission scheme this.minPriceForMinimumCommission = this.account.CashAmount/(this.numberOfTickersToBeChosen*100); this.maxPriceForMinimumCommission = this.maxPriceForMinimumCommission; //just to avoid warning message } /// <summary> /// Handles a "One hour after market close" event. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public override void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.seedForRandomGenerator++; foreach(ArrayList arrayList in this.ordersForAccounts) arrayList.Clear(); //this.oneHourAfterMarketCloseEventHandler_updatePrices(); if(this.numDaysElapsedSinceLastOptimization == this.numDaysBetweenEachOptimization - 1) { this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime, false); //sets tickers to be chosen next Market Open event this.numDaysElapsedSinceLastOptimization = 0; } else { this.numDaysElapsedSinceLastOptimization++; } } #endregion } } --- NEW FILE: RunEfficientCTOPortfolioMultiAccount.cs --- /* QuantProject - Quantitative Finance Library RunEfficientCTOPorfolioMultiAccount.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 System.Data; using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.ADT.FileManaging; using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Accounting.Reporting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Scripting; using QuantProject.Business.Strategies; using QuantProject.Business.Testing; using QuantProject.Business.Timing; using QuantProject.Business.Financial.Accounting.Commissions; using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; using QuantProject.Presentation.Reporting.WindowsForm; namespace QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios { /// <summary> /// Script to buy at open and sell at close /// the efficient close to open daily portfolio /// The efficient portfolio's generation rules /// (contained in the EndOfDayTimerHandler) are: /// - choose the most liquid tickers; /// - choose the most efficient portfolio among these tickers /// </summary> [Serializable] public class RunEfficientCTOPorfolioMultiAccount : RunEfficientPortfolio { protected int numDaysBetweenEachOptimization; private int distanceBetweenEachGenomeToTest; private int numberOfAccounts; private Account[] accounts; public RunEfficientCTOPorfolioMultiAccount(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, DateTime startDate, DateTime endDate, double targetReturn, PortfolioType portfolioType, double maxRunningHours, int numDaysBetweenEachOptimization, int numberOfAccounts, int distanceBetweenEachGenomeToTest): base(tickerGroupID, numberOfEligibleTickers, numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, startDate, endDate, targetReturn, portfolioType, maxRunningHours) { this.ScriptName = "MultiAccountOpenCloseScripts"; this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; this.distanceBetweenEachGenomeToTest = distanceBetweenEachGenomeToTest; this.numberOfAccounts = numberOfAccounts; this.accounts = new Account[numberOfAccounts]; } #region auxiliary overriden methods for Run protected override void run_initializeAccount() { for(int i = 0; i<this.accounts.Length; i++) { this.accounts[i] = new Account( this.ScriptName , this.endOfDayTimer , new HistoricalEndOfDayDataStreamer( this.endOfDayTimer , this.historicalQuoteProvider ) , new HistoricalEndOfDayOrderExecutor( this.endOfDayTimer , this.historicalQuoteProvider )); } } protected override void run_initializeEndOfDayTimerHandler() { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTOMultiAccount(this.tickerGroupID, this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, this.accounts, this.generationNumberForGeneticOptimizer, this.populationSizeForGeneticOptimizer, this.benchmark, this.targetReturn, this.portfolioType, this.numDaysBetweenEachOptimization,this.numberOfAccounts, this.distanceBetweenEachGenomeToTest); } protected override void run_initializeHistoricalQuoteProvider() { this.historicalQuoteProvider = new HistoricalRawQuoteProvider(); //this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); } protected override void run_addEventHandlers() { this.endOfDayTimer.MarketOpen += new MarketOpenEventHandler( this.endOfDayTimerHandler.MarketOpenEventHandler); this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( this.endOfDayTimerHandler.MarketCloseEventHandler); this.endOfDayTimer.MarketClose += new MarketCloseEventHandler( this.checkDateForReport); this.endOfDayTimer.OneHourAfterMarketClose += new OneHourAfterMarketCloseEventHandler( this.endOfDayTimerHandler.OneHourAfterMarketCloseEventHandler ); } #endregion //necessary far calling RunEfficientPortfolio.Run() //in classes that inherit from this class public override void Run() { base.Run(); } public override void SaveScriptResults() { string fileName = "From"+this.numberOfEligibleTickers + "OptDays" + this.numDaysForOptimizationPeriod + "Portfolio" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + "PopSize" + this.populationSizeForGeneticOptimizer + "Target" + Convert.ToString(this.targetReturn) + Convert.ToString(this.portfolioType); string dirNameWhereToSaveAccounts = System.Configuration.ConfigurationSettings.AppSettings["AccountsArchive"] + "\\" + this.ScriptName + "\\"; this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveAccounts); for(int i = 0; i<this.accounts.Length; i++) ObjectArchiver.Archive(accounts[i], dirNameWhereToSaveAccounts + fileName + "#" + i.ToString() + ".qPa"); this.endOfDayTimer.Stop(); } } } |
|
From: Marco M. <mi...@us...> - 2005-09-27 22:30:06
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10794/b7_Scripts Modified Files: b7_Scripts.csproj Log Message: Added MultiAccount script for the open to close strategy. Index: b7_Scripts.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/b7_Scripts.csproj,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** b7_Scripts.csproj 20 Aug 2005 16:08:47 -0000 1.37 --- b7_Scripts.csproj 27 Sep 2005 22:29:58 -0000 1.38 *************** *** 204,207 **** --- 204,212 ---- /> <File + RelPath = "TickerSelectionTesting\EndOfDayTimerHandlerCTOMultiAccount.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\EndOfDayTimerHandlerCTOTest.cs" SubType = "Code" *************** *** 254,257 **** --- 259,267 ---- /> <File + RelPath = "TickerSelectionTesting\RunEfficientCTOPortfolioMultiAccount.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "TickerSelectionTesting\RunEfficientPortfolio.cs" SubType = "Code" |
|
From: Marco M. <mi...@us...> - 2005-09-27 22:26:11
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/EvaluatingOptimizationTechnique/EfficientPortfolio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9846/b7_Scripts/EvaluatingOptimizationTechnique/EfficientPortfolio Modified Files: RunTestingOptimizationOpenToClose.cs Log Message: The test for the optimization technique on open to close script has been modified. The comparison between fitness in sample and fitness out of sample concerns now only the best genomes (all different in genes) and the worst ones (all different in genes). Index: RunTestingOptimizationOpenToClose.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/EvaluatingOptimizationTechnique/EfficientPortfolio/RunTestingOptimizationOpenToClose.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunTestingOptimizationOpenToClose.cs 28 Aug 2005 10:02:52 -0000 1.2 --- RunTestingOptimizationOpenToClose.cs 27 Sep 2005 22:26:02 -0000 1.3 *************** *** 45,49 **** private int numberOfEligibleTickers; private int numberOfTickersToBeChosen; ! private int numDaysForLiquidity; private int populationSizeForGeneticOptimizer; private int generationNumberForGeneticOptimizer; --- 45,49 ---- private int numberOfEligibleTickers; private int numberOfTickersToBeChosen; ! private int numDaysForOptimization; private int populationSizeForGeneticOptimizer; private int generationNumberForGeneticOptimizer; *************** *** 56,62 **** private Genome[] genomesToTestOutOfSample; private int numberOfGenomesToTest; ! public RunTestingOptimizationOpenToClose(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 56,62 ---- private Genome[] genomesToTestOutOfSample; private int numberOfGenomesToTest; ! public RunTestingOptimizationOpenToClose(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimization, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 72,76 **** this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForLiquidity = numDaysForLiquidity; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; --- 72,76 ---- this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForOptimization = numDaysForOptimization; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; *************** *** 81,86 **** this.numDaysAfterLastOptimizationDay = numDaysAfterLastOptimizationDay; this.numberOfSubsets = numberOfSubsets; ! ! } private DataTable getSetOfTickersToBeOptimized(DateTime date) --- 81,85 ---- this.numDaysAfterLastOptimizationDay = numDaysAfterLastOptimizationDay; this.numberOfSubsets = numberOfSubsets; ! } private DataTable getSetOfTickersToBeOptimized(DateTime date) *************** *** 89,93 **** SelectorByAverageRawOpenPrice selectorByOpenPrice = new SelectorByAverageRawOpenPrice(this.tickerGroupID, false, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.minPriceForMinimumCommission, this.maxPriceForMinimumCommission, 0, 2); --- 88,92 ---- SelectorByAverageRawOpenPrice selectorByOpenPrice = new SelectorByAverageRawOpenPrice(this.tickerGroupID, false, ! currentDate.AddDays(-this.numDaysForOptimization), currentDate, this.numberOfEligibleTickers, this.minPriceForMinimumCommission, this.maxPriceForMinimumCommission, 0, 2); *************** *** 95,176 **** */ ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID, false, ! date.AddDays(-this.numDaysForLiquidity), date, ! this.numberOfEligibleTickers); ! /*SelectorByOpenToCloseVolatility lessVolatile = ! new SelectorByOpenToCloseVolatility(mostLiquid.GetTableOfSelectedTickers(), ! true, currentDate.AddDays(-5), ! currentDate, ! this.numberOfEligibleTickers/2);*/ DataTable eligibleTickers; ! eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( eligibleTickers, ! false, date.AddDays(-this.numDaysForLiquidity), date, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = ! // new SelectorByWinningOpenToClose(quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(), ! // false, currentDate.AddDays(-2), ! // currentDate, this.numberOfEligibleTickers/4); //return winners.GetTableOfSelectedTickers(); ! //SelectorByOpenCloseCorrelationToBenchmark lessCorrelated = ! // new SelectorByOpenCloseCorrelationToBenchmark(quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(), ! // this.benchmark, true, ! // currentDate.AddDays(-this.numDaysForLiquidity), ! // currentDate, this.numberOfEligibleTickers/2); return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); //return lessCorrelated.GetTableOfSelectedTickers(); } ! private double setFitnesses_setFitnessesActually_getFitnessOutOfSample(Genome genome) { ! double returnValue = 0; ! foreach(string tickerCode in (string[])genome.Meaning) ! { ! double coefficient = 1.0; ! string ticker = tickerCode; ! if(ticker.StartsWith("-")) ! { ! ticker = ticker.Substring(1,ticker.Length -1); ! coefficient = -1.0; ! } ! DateTime dateOutOfSample = this.marketDate.AddDays(this.numDaysAfterLastOptimizationDay); ! Quotes tickerQuotes = new Quotes(ticker, dateOutOfSample, ! dateOutOfSample); ! returnValue += ! (tickerQuotes.GetFirstValidRawClose(dateOutOfSample)/ ! tickerQuotes.GetFirstValidRawOpen(dateOutOfSample) - 1.0)*coefficient; ! } ! return returnValue/genome.Size; } ! private void setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample(GeneticOptimizer GO) { ! Random random = new Random(10); ! for(int i = 0; i<this.numberOfGenomesToTest; i++) ! { ! this.genomesToTestOutOfSample[i]= ! (Genome)GO.CurrentGeneration[random.Next(this.populationSizeForGeneticOptimizer)]; ! } ! Array.Sort(this.genomesToTestOutOfSample); } ! private void setFitnesses_setFitnessesActually(GeneticOptimizer GO) { ! this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample(GO); ! for(int i = 0; i<this.numberOfGenomesToTest; i++) ! { ! this.fitnessesInSample[i]=(this.genomesToTestOutOfSample[i]).Fitness; ! this.fitnessesOutOfSample[i]= ! this.setFitnesses_setFitnessesActually_getFitnessOutOfSample(this.genomesToTestOutOfSample[i]); ! } } ! ! private void setFitnesses() { --- 94,240 ---- */ ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, ! date); ! ! SelectorByOpenCloseCorrelationToBenchmark lessCorrelatedFromTemporizedGroup = ! new SelectorByOpenCloseCorrelationToBenchmark(temporizedGroup.GetTableOfSelectedTickers(), ! this.benchmark,true, ! date.AddDays(-this.numDaysForOptimization ), ! date, ! this.numberOfEligibleTickers); ! DataTable eligibleTickers; ! eligibleTickers = lessCorrelatedFromTemporizedGroup.GetTableOfSelectedTickers(); ! //eligibleTickers = temporizedGroup.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( eligibleTickers, ! false, date.AddDays(-this.numDaysForOptimization), date, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = ! //new SelectorByWinningOpenToClose(quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(), ! // false, date.AddDays(-1), ! // date.AddDays(-1), this.numberOfEligibleTickers/2, ! // true); //return winners.GetTableOfSelectedTickers(); ! return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); //return lessCorrelated.GetTableOfSelectedTickers(); } ! private double setFitnesses_setFitnessesActually_getFitnessOutOfSample(Genome genome) { ! double returnValue = 0; ! foreach(string tickerCode in (string[])genome.Meaning) ! { ! double coefficient = 1.0; ! string ticker = tickerCode; ! if(ticker.StartsWith("-")) ! { ! ticker = ticker.Substring(1,ticker.Length -1); ! coefficient = -1.0; ! } ! DateTime dateOutOfSample = this.marketDate.AddDays(this.numDaysAfterLastOptimizationDay); ! Quotes tickerQuotes = new Quotes(ticker, dateOutOfSample, ! dateOutOfSample); ! returnValue += ! (tickerQuotes.GetFirstValidRawClose(dateOutOfSample)/ ! tickerQuotes.GetFirstValidRawOpen(dateOutOfSample) - 1.0)*coefficient; ! } ! return returnValue/genome.Size; } + + private bool setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes_sharesNoGeneWithGenomesAlreadyAdded(Genome genomeToBeAdded, + bool addWorstGenomes) + + { + bool returnValue = true; + if(addWorstGenomes) + //the first half containing the worst genomes has to be checked + { + for(int i = 0; i<this.numberOfGenomesToTest/2; i++) + { + if(this.genomesToTestOutOfSample[i]==null) + return true; + if(!genomeToBeAdded.SharesNoGeneWith(this.genomesToTestOutOfSample[i])) + return false; + } + } + else + //the second half containing the best genomes has to be checked + { + for(int i = 0; i<this.numberOfGenomesToTest/2; i++) + { + if(this.genomesToTestOutOfSample[this.numberOfGenomesToTest-1-i]==null) + return true; + if(!genomeToBeAdded.SharesNoGeneWith(this.genomesToTestOutOfSample[this.numberOfGenomesToTest-1-i])) + return false; + } + } + return returnValue; + } + private void setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes(GeneticOptimizer optimizer, + bool addWorstGenomes) + + { + Genome currentGenome; + Genome previousGenome = null; + int numOfDifferentGenomesFound = 0; + for(int j = 0; + j<this.populationSizeForGeneticOptimizer && numOfDifferentGenomesFound<this.numberOfGenomesToTest/2; + j++) + { + if(addWorstGenomes == true) + currentGenome = (Genome)optimizer.CurrentGeneration[j]; + else + currentGenome = (Genome)optimizer.CurrentGeneration[this.populationSizeForGeneticOptimizer-j-1]; + + if(this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes_sharesNoGeneWithGenomesAlreadyAdded(currentGenome, addWorstGenomes)) + //no genes of the current genome are present in the relative half + { + if(this.genomesToTestOutOfSample[numOfDifferentGenomesFound]!= null) + //the first half of the array has already been filled + this.genomesToTestOutOfSample[this.numberOfGenomesToTest-1-numOfDifferentGenomesFound]=currentGenome; + else//the first half is still empty + this.genomesToTestOutOfSample[numOfDifferentGenomesFound] = currentGenome; + previousGenome = currentGenome; + numOfDifferentGenomesFound++; + } + + } + + } ! private void setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample(IGenomeManager genomeManager) { ! GeneticOptimizer optimizer = new GeneticOptimizer(genomeManager, ! this.populationSizeForGeneticOptimizer, ! this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); ! optimizer.Run(false); ! this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes(optimizer, ! true); ! this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample_addGenomes(optimizer, ! false); ! Array.Sort(this.genomesToTestOutOfSample); } ! ! private void setFitnesses_setFitnessesActually(IGenomeManager genomeManager) { ! this.setFitnesses_setFitnessesActually_setGenomesToTestOutOfSample(genomeManager); ! for(int i = 0; i<this.numberOfGenomesToTest; i++) ! { ! this.fitnessesInSample[i]=(this.genomesToTestOutOfSample[i]).Fitness; ! this.fitnessesOutOfSample[i]= ! this.setFitnesses_setFitnessesActually_getFitnessOutOfSample(this.genomesToTestOutOfSample[i]); ! } } ! ! private void setFitnesses() { *************** *** 180,196 **** IGenomeManager genManEfficientCTOPortfolio = new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, ! this.marketDate.AddDays(-this.numDaysForLiquidity), this.marketDate, this.numberOfTickersToBeChosen, this.targetReturn, this.portfolioType); ! ! GeneticOptimizer GO = new GeneticOptimizer(genManEfficientCTOPortfolio, ! this.populationSizeForGeneticOptimizer, ! this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); ! ! GO.Run(false); ! this.setFitnesses_setFitnessesActually(GO); } --- 244,254 ---- IGenomeManager genManEfficientCTOPortfolio = new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, ! this.marketDate.AddDays(-this.numDaysForOptimization), this.marketDate, this.numberOfTickersToBeChosen, this.targetReturn, this.portfolioType); ! ! this.setFitnesses_setFitnessesActually(genManEfficientCTOPortfolio); } *************** *** 198,206 **** public void Run() { ! this.setFitnesses(); ! OptimizationTechniqueEvaluator evaluator = ! new OptimizationTechniqueEvaluator(this.fitnessesInSample, ! this.fitnessesOutOfSample); ! this.run_writeToLogFile(evaluator); } --- 256,271 ---- public void Run() { ! try ! { ! this.setFitnesses(); ! OptimizationTechniqueEvaluator evaluator = ! new OptimizationTechniqueEvaluator(this.fitnessesInSample, ! this.fitnessesOutOfSample); ! this.run_writeToLogFile(evaluator); ! } ! catch(Exception ex) ! { ! ex = ex; ! } } *************** *** 218,223 **** StreamWriter w = File.AppendText(pathFile); w.WriteLine ("\n----------------------------------------------\r\n"); ! w.Write("\r\nNew Test for Evaluation of Open To Close Optimization {0}\r", DateTime.Now.Date.ToLongDateString()); ! w.WriteLine ("\n----------------------------------------------"); w.Write("\r\nFitnesses compared: {0}\r", this.fitnessesInSample.Length.ToString()); w.Write("\r\nDifferent evaluated genomes: {0}\r", differentEvaluatedGenomes.ToString()); --- 283,293 ---- StreamWriter w = File.AppendText(pathFile); w.WriteLine ("\n----------------------------------------------\r\n"); ! w.Write("\r\nNew Test for Evaluation of Open To Close Optimization {0}\r", DateTime.Now.ToLongDateString()+ " " +DateTime.Now.ToLongTimeString()); ! w.Write("\r\nNum days for optimization {0}\r", this.numDaysForOptimization.ToString()); ! w.Write("\r\nOptimizing market date {0}\r", this.marketDate.ToLongDateString()); ! w.Write("\r\nMarket date for test (out of sample){0}\r", ! this.marketDate.AddDays(this.numDaysAfterLastOptimizationDay).ToLongDateString()); ! w.Write("\r\nNumber of tickers: {0}\r", this.numberOfTickersToBeChosen.ToString()); ! w.WriteLine ("\n----------------------------------------------"); w.Write("\r\nFitnesses compared: {0}\r", this.fitnessesInSample.Length.ToString()); w.Write("\r\nDifferent evaluated genomes: {0}\r", differentEvaluatedGenomes.ToString()); |
|
From: Marco M. <mi...@us...> - 2005-09-27 22:18:01
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7963/b7_Scripts/TickerSelectionTesting Modified Files: RunEfficientPortfolio.cs Log Message: checkDateForReport_createDirIfNotPresent has been changed to protected (from private) Index: RunEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientPortfolio.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** RunEfficientPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.16 --- RunEfficientPortfolio.cs 27 Sep 2005 22:17:51 -0000 1.17 *************** *** 198,202 **** } ! private void checkDateForReport_createDirIfNotPresent(string dirPath) { if(!Directory.Exists(dirPath)) --- 198,202 ---- } ! protected void checkDateForReport_createDirIfNotPresent(string dirPath) { if(!Directory.Exists(dirPath)) |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3017/b7_Scripts/TickerSelectionTesting Modified Files: EndOfDayTimerHandler.cs EndOfDayTimerHandlerCTC.cs EndOfDayTimerHandlerCTCTest.cs EndOfDayTimerHandlerCTCWeekly.cs EndOfDayTimerHandlerCTO.cs EndOfDayTimerHandlerCTOTest.cs RunEfficientCTCPortfolio.cs RunEfficientCTCWeeklyPortfolio.cs RunEfficientCTOPortfolio.cs RunEfficientPortfolio.cs RunTestOptimizedCTCPortfolio.cs RunTestOptimizedCTOPortfolio.cs Log Message: numDaysForLiquidity has been named numDaysForOptimizationDays (due to the fact that SelectorByLiquidity is not used anymore) Index: RunTestOptimizedCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTOPortfolio.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RunTestOptimizedCTOPortfolio.cs 3 Aug 2005 18:55:11 -0000 1.8 --- RunTestOptimizedCTOPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.9 *************** *** 55,59 **** public RunTestOptimizedCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 55,59 ---- public RunTestOptimizedCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 62,69 **** int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForLiquidity), endDate, targetReturn, portfolioType, maxRunningHours, numDaysBetweenEachOptimization) --- 62,69 ---- int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForOptimizationPeriod), endDate, targetReturn, portfolioType, maxRunningHours, numDaysBetweenEachOptimization) *************** *** 77,81 **** this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 77,81 ---- this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandler.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** EndOfDayTimerHandler.cs 28 Aug 2005 10:05:03 -0000 1.16 --- EndOfDayTimerHandler.cs 18 Sep 2005 21:13:36 -0000 1.17 *************** *** 31,34 **** --- 31,35 ---- using QuantProject.Data.DataProviders; using QuantProject.Data.Selectors; + using QuantProject.Data.DataTables; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.Scripts.WalkForwardTesting.LinearCombination; *************** *** 45,54 **** protected DataTable eligibleTickers; protected string[] chosenTickers; ! protected string[] lastChosenTickers; protected string tickerGroupID; protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForLiquidity; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; --- 46,55 ---- protected DataTable eligibleTickers; protected string[] chosenTickers; ! protected string[] lastOrderedTickers; protected string tickerGroupID; protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForOptimizationPeriod; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; *************** *** 74,80 **** } ! public string[] LastChosenTickers { ! get { return this.chosenTickers; } } public int NumberOfEligibleTickers --- 75,81 ---- } ! public string[] LastOrderedTickers { ! get { return this.lastOrderedTickers; } } public int NumberOfEligibleTickers *************** *** 98,102 **** } public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, --- 99,103 ---- } public EndOfDayTimerHandler(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, *************** *** 107,111 **** this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForLiquidity = numDaysForLiquidity; this.account = account; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; --- 108,112 ---- this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForOptimizationPeriod = numDaysForOptimizationPeriod; this.account = account; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; *************** *** 114,118 **** this.orders = new ArrayList(); this.chosenTickers = new string[numberOfTickersToBeChosen]; ! this.lastChosenTickers = new string[numberOfTickersToBeChosen]; this.targetReturn = targetReturn; this.portfolioType = portfolioType; --- 115,119 ---- this.orders = new ArrayList(); this.chosenTickers = new string[numberOfTickersToBeChosen]; ! this.lastOrderedTickers = new string[numberOfTickersToBeChosen]; this.targetReturn = targetReturn; this.portfolioType = portfolioType; *************** *** 131,135 **** this.chosenTickers = chosenTickers; this.numberOfTickersToBeChosen = chosenTickers.Length; ! this.lastChosenTickers = new string[chosenTickers.Length]; this.portfolioType = portfolioType; } --- 132,136 ---- this.chosenTickers = chosenTickers; this.numberOfTickersToBeChosen = chosenTickers.Length; ! this.lastOrderedTickers = new string[chosenTickers.Length]; this.portfolioType = portfolioType; } *************** *** 161,167 **** protected virtual void closePositions() { ! if(this.lastChosenTickers != null) { ! foreach( string ticker in this.lastChosenTickers) { for(int i = 0; i<this.account.Portfolio.Keys.Count; i++) --- 162,169 ---- protected virtual void closePositions() { ! ! if(this.lastOrderedTickers != null) { ! foreach( string ticker in this.lastOrderedTickers) { for(int i = 0; i<this.account.Portfolio.Keys.Count; i++) *************** *** 171,175 **** } } ! } } --- 173,179 ---- } } ! } ! ! } *************** *** 182,186 **** { this.addOrderForTicker( ticker ); ! this.lastChosenTickers[idx] = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); } --- 186,190 ---- { this.addOrderForTicker( ticker ); ! this.lastOrderedTickers[idx] = GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker); } *************** *** 188,191 **** --- 192,214 ---- } } + + protected bool openPositions_allChosenTickersQuotedAtCurrentDate() + { + bool returnValue = true; + DateTime currentDate = this.Account.EndOfDayTimer.GetCurrentTime().DateTime; + foreach(string ticker in this.chosenTickers) + { + if(ticker != null) + { + Quotes tickerQuotes = new Quotes(GenomeManagerForEfficientPortfolio.GetCleanTickerCode(ticker), + currentDate, currentDate); + if(tickerQuotes.Rows.Count == 0) + //no quote available for the current ticker + returnValue = false; + } + } + return returnValue; + } + protected virtual void openPositions() { *************** *** 193,203 **** if(this.orders.Count == 0 && this.account.Transactions.Count == 0) this.account.AddCash(17000); ! ! this.addChosenTickersToOrderList(); ! ! //execute orders actually ! foreach(object item in this.orders) { ! this.account.AddOrder((Order)item); } } --- 216,226 ---- if(this.orders.Count == 0 && this.account.Transactions.Count == 0) this.account.AddCash(17000); ! if(this.openPositions_allChosenTickersQuotedAtCurrentDate()) ! //all tickers have quotes at the current date, so orders can be filled { ! this.addChosenTickersToOrderList(); ! //execute orders actually ! foreach(object item in this.orders) ! this.account.AddOrder((Order)item); } } Index: RunEfficientCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCPortfolio.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RunEfficientCTCPortfolio.cs 27 Jul 2005 22:30:55 -0000 1.10 --- RunEfficientCTCPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.11 *************** *** 64,68 **** public RunEfficientCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 64,68 ---- public RunEfficientCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 73,77 **** double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, --- 73,77 ---- double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, *************** *** 90,94 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTC(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 90,94 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTC(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: RunTestOptimizedCTCPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunTestOptimizedCTCPortfolio.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** RunTestOptimizedCTCPortfolio.cs 3 Aug 2005 18:55:11 -0000 1.6 --- RunTestOptimizedCTCPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.7 *************** *** 62,66 **** public RunTestOptimizedCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 62,66 ---- public RunTestOptimizedCTCPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 71,78 **** double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForLiquidity), endDate, numDaysOfPortfolioLife - 1, numDaysForReturnCalculation, targetReturn, --- 71,78 ---- double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, ! endDate.AddDays(-numDaysForOptimizationPeriod), endDate, numDaysOfPortfolioLife - 1, numDaysForReturnCalculation, targetReturn, *************** *** 87,91 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCTest(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 87,91 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCTest(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: EndOfDayTimerHandlerCTO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** EndOfDayTimerHandlerCTO.cs 28 Aug 2005 10:05:03 -0000 1.17 --- EndOfDayTimerHandlerCTO.cs 18 Sep 2005 21:13:36 -0000 1.18 *************** *** 46,52 **** protected int numDaysBetweenEachOptimization; private int numDaysElapsedSinceLastOptimization; public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, --- 46,53 ---- protected int numDaysBetweenEachOptimization; private int numDaysElapsedSinceLastOptimization; + protected int seedForRandomGenerator; public EndOfDayTimerHandlerCTO(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, *************** *** 54,58 **** PortfolioType portfolioType, int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, --- 55,59 ---- PortfolioType portfolioType, int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, *************** *** 62,65 **** --- 63,67 ---- this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; this.numDaysElapsedSinceLastOptimization = 0; + this.seedForRandomGenerator = ConstantsProvider.SeedForRandomGenerator; } *************** *** 105,121 **** */ ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID, false, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, ! this.numberOfEligibleTickers); ! /*SelectorByOpenToCloseVolatility lessVolatile = ! new SelectorByOpenToCloseVolatility(mostLiquid.GetTableOfSelectedTickers(), ! true, currentDate.AddDays(-5), ! currentDate, ! this.numberOfEligibleTickers/2);*/ ! this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = --- 107,122 ---- */ ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, currentDate); ! SelectorByOpenCloseCorrelationToBenchmark lessCorrelatedFromTemporizedGroup = ! new SelectorByOpenCloseCorrelationToBenchmark(temporizedGroup.GetTableOfSelectedTickers(), ! this.benchmark,true, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod ), ! currentDate, ! this.numberOfEligibleTickers); ! this.eligibleTickers = lessCorrelatedFromTemporizedGroup.GetTableOfSelectedTickers(); SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay( this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfEligibleTickers, this.benchmark); //SelectorByWinningOpenToClose winners = *************** *** 145,149 **** IGenomeManager genManEfficientCTOPortfolio = new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfTickersToBeChosen, --- 146,150 ---- IGenomeManager genManEfficientCTOPortfolio = new GenomeManagerForEfficientCTOPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, *************** *** 154,163 **** this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForLiquidity), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; --- 155,164 ---- this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! this.seedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; *************** *** 184,188 **** Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! ConstantsProvider.SeedForRandomGenerator++; this.orders.Clear(); //this.oneHourAfterMarketCloseEventHandler_updatePrices(); --- 185,189 ---- Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! this.seedForRandomGenerator++; this.orders.Clear(); //this.oneHourAfterMarketCloseEventHandler_updatePrices(); Index: EndOfDayTimerHandlerCTOTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTOTest.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EndOfDayTimerHandlerCTOTest.cs 27 Jul 2005 22:30:55 -0000 1.6 --- EndOfDayTimerHandlerCTOTest.cs 18 Sep 2005 21:13:36 -0000 1.7 *************** *** 69,73 **** if(!EndOfDayTimerHandlerCTOTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForLiquidity), true); EndOfDayTimerHandlerCTOTest.optimized = true; --- 69,73 ---- if(!EndOfDayTimerHandlerCTOTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForOptimizationPeriod), true); EndOfDayTimerHandlerCTOTest.optimized = true; Index: RunEfficientPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientPortfolio.cs,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RunEfficientPortfolio.cs 28 Aug 2005 09:57:02 -0000 1.15 --- RunEfficientPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.16 *************** *** 57,61 **** protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForLiquidity; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; --- 57,61 ---- protected int numberOfEligibleTickers; protected int numberOfTickersToBeChosen; ! protected int numDaysForOptimizationPeriod; protected int generationNumberForGeneticOptimizer; protected int populationSizeForGeneticOptimizer; *************** *** 89,95 **** //is still running, it will be stopped. ! public string[] LastChosenTickers { ! get { return this.endOfDayTimerHandler.LastChosenTickers; } } public PortfolioType TypeOfPortfolio --- 89,95 ---- //is still running, it will be stopped. ! public string[] LastOrderedTickers { ! get { return this.endOfDayTimerHandler.LastOrderedTickers; } } public PortfolioType TypeOfPortfolio *************** *** 128,132 **** public RunEfficientPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 128,132 ---- public RunEfficientPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 140,144 **** this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForLiquidity = numDaysForLiquidity; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; --- 140,144 ---- this.numberOfEligibleTickers = numberOfEligibleTickers; this.numberOfTickersToBeChosen = numberOfTickersToBeChosen; ! this.numDaysForOptimizationPeriod = numDaysForOptimizationPeriod; this.generationNumberForGeneticOptimizer = generationNumberForGeneticOptimizer; this.populationSizeForGeneticOptimizer = populationSizeForGeneticOptimizer; *************** *** 216,220 **** { string fileName = "From"+this.numberOfEligibleTickers + ! "LiqDays" + this.numDaysForLiquidity + "Portfolio" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + --- 216,220 ---- { string fileName = "From"+this.numberOfEligibleTickers + ! "OptDays" + this.numDaysForOptimizationPeriod + "Portfolio" + this.numberOfTickersToBeChosen + "GenNum" + this.generationNumberForGeneticOptimizer + Index: EndOfDayTimerHandlerCTCTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTCTest.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerCTCTest.cs 27 Jul 2005 22:30:55 -0000 1.3 --- EndOfDayTimerHandlerCTCTest.cs 18 Sep 2005 21:13:36 -0000 1.4 *************** *** 48,52 **** public EndOfDayTimerHandlerCTCTest(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, --- 48,52 ---- public EndOfDayTimerHandlerCTCTest(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, *************** *** 58,62 **** PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, --- 58,62 ---- PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, *************** *** 77,81 **** if(!EndOfDayTimerHandlerCTCTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForLiquidity), true); EndOfDayTimerHandlerCTCTest.optimized = true; --- 77,81 ---- if(!EndOfDayTimerHandlerCTCTest.optimized) { ! base.setTickers(currentDate.AddDays(this.numDaysForOptimizationPeriod), true); EndOfDayTimerHandlerCTCTest.optimized = true; Index: RunEfficientCTOPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTOPortfolio.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** RunEfficientCTOPortfolio.cs 27 Jul 2005 22:30:56 -0000 1.21 --- RunEfficientCTOPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.22 *************** *** 58,62 **** protected int numDaysBetweenEachOptimization; public RunEfficientCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 58,62 ---- protected int numDaysBetweenEachOptimization; public RunEfficientCTOPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 65,69 **** int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, --- 65,69 ---- int numDaysBetweenEachOptimization): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, *************** *** 94,98 **** this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 94,98 ---- this.numberOfEligibleTickers, this.numberOfTickersToBeChosen, ! this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, *************** *** 106,109 **** --- 106,110 ---- { this.historicalQuoteProvider = new HistoricalRawQuoteProvider(); + //this.historicalQuoteProvider = new HistoricalAdjustedQuoteProvider(); } Index: RunEfficientCTCWeeklyPortfolio.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/RunEfficientCTCWeeklyPortfolio.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RunEfficientCTCWeeklyPortfolio.cs 27 Jul 2005 22:22:02 -0000 1.1 --- RunEfficientCTCWeeklyPortfolio.cs 18 Sep 2005 21:13:36 -0000 1.2 *************** *** 58,62 **** public RunEfficientCTCWeeklyPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, --- 58,62 ---- public RunEfficientCTCWeeklyPortfolio(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, *************** *** 67,71 **** double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, --- 67,71 ---- double maxRunningHours): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, benchmark, *************** *** 83,87 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCWeekly(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForLiquidity, this.account, this.generationNumberForGeneticOptimizer, --- 83,87 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerCTCWeekly(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, this.account, this.generationNumberForGeneticOptimizer, Index: EndOfDayTimerHandlerCTCWeekly.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTCWeekly.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayTimerHandlerCTCWeekly.cs 27 Jul 2005 22:22:02 -0000 1.1 --- EndOfDayTimerHandlerCTCWeekly.cs 18 Sep 2005 21:13:36 -0000 1.2 *************** *** 51,55 **** public EndOfDayTimerHandlerCTCWeekly(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, --- 51,55 ---- public EndOfDayTimerHandlerCTCWeekly(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, *************** *** 60,64 **** PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, --- 60,64 ---- PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, *************** *** 115,128 **** protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByLiquidity mostLiquid = new SelectorByLiquidity(this.tickerGroupID,false, ! currentDate.AddDays(-this.numDaysForLiquidity), ! currentDate, ! this.numberOfEligibleTickers); ! this.eligibleTickers = mostLiquid.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromMostLiquid = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForLiquidity),currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 115,127 ---- protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, ! currentDate); ! ! this.eligibleTickers = temporizedGroup.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForOptimizationPeriod),currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); } *************** *** 143,147 **** IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, --- 142,146 ---- IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, Index: EndOfDayTimerHandlerCTC.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTC.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** EndOfDayTimerHandlerCTC.cs 28 Aug 2005 10:05:03 -0000 1.13 --- EndOfDayTimerHandlerCTC.cs 18 Sep 2005 21:13:36 -0000 1.14 *************** *** 53,57 **** public EndOfDayTimerHandlerCTC(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForLiquidity, Account account, int generationNumberForGeneticOptimizer, --- 53,57 ---- public EndOfDayTimerHandlerCTC(string tickerGroupID, int numberOfEligibleTickers, ! int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, Account account, int generationNumberForGeneticOptimizer, *************** *** 63,67 **** PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForLiquidity, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, --- 63,67 ---- PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown): base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, account, generationNumberForGeneticOptimizer, populationSizeForGeneticOptimizer, *************** *** 134,147 **** protected 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, this.benchmark); ! return quotedInEachMarketDayFromMostLiquid.GetTableOfSelectedTickers(); } --- 134,146 ---- protected DataTable getSetOfTickersToBeOptimized(DateTime currentDate) { ! SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, ! currentDate); ! ! this.eligibleTickers = temporizedGroup.GetTableOfSelectedTickers(); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromEligible = new SelectorByQuotationAtEachMarketDay(this.eligibleTickers, ! false, currentDate.AddDays(-this.numDaysForOptimizationPeriod),currentDate, this.numberOfEligibleTickers, this.benchmark); ! return quotedAtEachMarketDayFromEligible.GetTableOfSelectedTickers(); } *************** *** 163,167 **** IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForLiquidity), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, --- 162,166 ---- IGenomeManager genManEfficientCTCPortfolio = new GenomeManagerForEfficientCTCPortfolio(setOfTickersToBeOptimized, ! currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, this.numDaysForReturnCalculation, *************** *** 176,180 **** GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForLiquidity), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; --- 175,179 ---- GO.Run(false); ! this.addGenomeToBestGenomes(GO.BestGenome,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate); this.chosenTickers = (string[])GO.BestGenome.Meaning; |
|
From: Marco M. <mi...@us...> - 2005-09-18 21:10:36
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2654/b3_Data/Selectors Modified Files: SelectorByOpenCloseCorrelationToBenchmark.cs Log Message: Fixed bug in the selector: absolute correlation is considered now. Index: SelectorByOpenCloseCorrelationToBenchmark.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectorByOpenCloseCorrelationToBenchmark.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SelectorByOpenCloseCorrelationToBenchmark.cs 17 May 2005 23:06:01 -0000 1.1 --- SelectorByOpenCloseCorrelationToBenchmark.cs 18 Sep 2005 21:10:28 -0000 1.2 *************** *** 31,35 **** { /// <summary> ! /// Class for selection on tickers by open close correlation to /// a given benchmark /// </summary> --- 31,35 ---- { /// <summary> ! /// Class for selection on tickers by open close absolute correlation to /// a given benchmark /// </summary> |
|
From: Marco M. <mi...@us...> - 2005-09-18 21:07:33
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2235/b1_ADT/Optimizing/Genetic Modified Files: Genome.cs Log Message: Added SharesNoGeneWith method. Index: Genome.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Optimizing/Genetic/Genome.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Genome.cs 28 Aug 2005 09:59:36 -0000 1.8 --- Genome.cs 18 Sep 2005 21:07:21 -0000 1.9 *************** *** 43,48 **** private bool hasBeenChanged; ! IGenomeManager genomeManager; ! public bool HasBeenCloned { --- 43,49 ---- private bool hasBeenChanged; ! private IGenomeManager genomeManager; ! private int generation; ! public bool HasBeenCloned { *************** *** 94,98 **** public int Generation { ! get{return this.genomeManager.CurrentGeneticOptimizer.GenerationCounter;} } --- 95,100 ---- public int Generation { ! get{return this.generation;} ! //set{this.generation = value;} } *************** *** 130,133 **** --- 132,138 ---- for (int i = 0 ; i < this.size ; i++) this.genes[i] = this.genomeManager.GetNewGeneValue(this); + //whenever at least one gene has been written, + //the current generation number is stored + this.generation = this.genomeManager.CurrentGeneticOptimizer.GenerationCounter; } *************** *** 161,164 **** --- 166,172 ---- for (int i = 0 ; i < this.size ; i++) this.genes[i] = valuesToBeCopied[i]; + //whenever at least one gene has been written, + //the current generation number is stored + this.generation = this.genomeManager.CurrentGeneticOptimizer.GenerationCounter; } *************** *** 169,172 **** --- 177,183 ---- this.genes[genePosition] = geneValue; + //whenever at least one gene has been written, + //the current generation number is stored + this.generation = this.genomeManager.CurrentGeneticOptimizer.GenerationCounter; this.hasBeenChanged = true; } *************** *** 195,198 **** --- 206,224 ---- /// <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 |
|
From: Marco M. <mi...@us...> - 2005-09-18 21:05:38
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1924/b4_Business Modified Files: Business.prjx Log Message: Updated #develop projects files. Index: Business.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business.prjx,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Business.prjx 8 Aug 2005 19:16:17 -0000 1.5 --- Business.prjx 18 Sep 2005 21:05:30 -0000 1.6 *************** *** 92,95 **** --- 92,96 ---- <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\PercentageSummaryRow.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\a2_Strategies\IEndOfDayStrategy.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\SharpeRatio.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-09-18 21:05:38
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1924/b3_Data Modified Files: b3_Data.csproj Log Message: Updated #develop projects files. Index: b3_Data.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/b3_Data.csproj,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** b3_Data.csproj 29 Jul 2005 13:26:03 -0000 1.30 --- b3_Data.csproj 18 Sep 2005 21:05:30 -0000 1.31 *************** *** 144,148 **** <File RelPath = "ExtendedDataTable.cs" ! SubType = "Code" BuildAction = "Compile" /> --- 144,148 ---- <File RelPath = "ExtendedDataTable.cs" ! SubType = "Component" BuildAction = "Compile" /> |
|
From: Marco M. <mi...@us...> - 2005-09-18 21:03:52
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1539/b3_Data/Selectors Modified Files: SelectorByWinningOpenToClose.cs Log Message: GetTickersByOpenToCloseWinningDays has been moved to Quotes class in data layer. Added new parameter to the method. Index: SelectorByWinningOpenToClose.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Selectors/SelectorByWinningOpenToClose.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SelectorByWinningOpenToClose.cs 19 Apr 2005 18:31:19 -0000 1.2 --- SelectorByWinningOpenToClose.cs 18 Sep 2005 21:03:44 -0000 1.3 *************** *** 36,44 **** public class SelectorByWinningOpenToClose : TickerSelector, ITickerSelector { ! public SelectorByWinningOpenToClose(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, ! long maxNumOfReturnedTickers): base(setOfTickersToBeSelected, orderInASCmode, --- 36,45 ---- public class SelectorByWinningOpenToClose : TickerSelector, ITickerSelector { ! private bool onlyTickersWithAtLeastOneWinningDay; public SelectorByWinningOpenToClose(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstQuoteDate, DateTime lastQuoteDate, ! long maxNumOfReturnedTickers, ! bool onlyTickersWithAtLeastOneWinningDay): base(setOfTickersToBeSelected, orderInASCmode, *************** *** 47,51 **** maxNumOfReturnedTickers) { ! } --- 48,52 ---- maxNumOfReturnedTickers) { ! this.onlyTickersWithAtLeastOneWinningDay = onlyTickersWithAtLeastOneWinningDay; } *************** *** 54,58 **** DateTime firstQuoteDate, DateTime lastQuoteDate, ! long maxNumOfReturnedTickers): base(groupID, orderInASCmode, --- 55,60 ---- DateTime firstQuoteDate, DateTime lastQuoteDate, ! long maxNumOfReturnedTickers, ! bool onlyTickersWithAtLeastOneWinningDay): base(groupID, orderInASCmode, *************** *** 61,65 **** maxNumOfReturnedTickers) { ! } --- 63,67 ---- maxNumOfReturnedTickers) { ! this.onlyTickersWithAtLeastOneWinningDay = onlyTickersWithAtLeastOneWinningDay; } *************** *** 69,77 **** if(this.setOfTickersToBeSelected == null) ! return QuantProject.DataAccess.Tables.Quotes.GetTickersByOpenToCloseWinningDays(this.isOrderedInASCMode, ! this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return QuantProject.Data.DataTables.Quotes.GetTickersByOpenToCloseWinningDays(this.isOrderedInASCMode, ! this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); } public void SelectAllTickers() --- 71,81 ---- if(this.setOfTickersToBeSelected == null) ! return QuantProject.Data.DataTables.Quotes.GetTickersByOpenToCloseWinningDays(this.isOrderedInASCMode, ! this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers, ! this.onlyTickersWithAtLeastOneWinningDay); else return QuantProject.Data.DataTables.Quotes.GetTickersByOpenToCloseWinningDays(this.isOrderedInASCMode, ! this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers, ! this.onlyTickersWithAtLeastOneWinningDay); } public void SelectAllTickers() |
|
From: Marco M. <mi...@us...> - 2005-09-18 21:03:51
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1539/b3_Data/DataTables Modified Files: Quotes.cs Log Message: GetTickersByOpenToCloseWinningDays has been moved to Quotes class in data layer. Added new parameter to the method. Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Quotes.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Quotes.cs 24 Jun 2005 22:40:34 -0000 1.17 --- Quotes.cs 18 Sep 2005 21:03:43 -0000 1.18 *************** *** 350,354 **** DateTime firstQuoteDate, DateTime lastQuoteDate, ! long maxNumOfReturnedTickers) { if(!setOfTickers.Columns.Contains("NumOpenCloseWinningDays")) --- 350,355 ---- DateTime firstQuoteDate, DateTime lastQuoteDate, ! long maxNumOfReturnedTickers, ! bool onlyTickersWithAtLeastOneWinningDay) { if(!setOfTickers.Columns.Contains("NumOpenCloseWinningDays")) *************** *** 360,367 **** firstQuoteDate, lastQuoteDate); } ! DataTable returnValue = ExtendedDataTable.CopyAndSort(setOfTickers,"NumOpenCloseWinningDays", orderByASC); ExtendedDataTable.DeleteRows(returnValue, maxNumOfReturnedTickers); return returnValue; } private static float[] getArrayOfCloseToOpenRatios(string ticker, --- 361,394 ---- firstQuoteDate, lastQuoteDate); } ! string filter_onlyTickersWithAtLeastOneWinningDay = ""; ! if(onlyTickersWithAtLeastOneWinningDay) ! filter_onlyTickersWithAtLeastOneWinningDay = "NumOpenCloseWinningDays>0"; ! DataTable returnValue = ! ExtendedDataTable.CopyAndSort(setOfTickers, ! filter_onlyTickersWithAtLeastOneWinningDay, ! "NumOpenCloseWinningDays", orderByASC); ExtendedDataTable.DeleteRows(returnValue, maxNumOfReturnedTickers); return returnValue; } + /// <summary> + /// returns tickers counting how many times raw close is greater than raw open + /// for the given interval of days (within the given table of tickers). + /// Tickers are ordered by the number of days raw open is greater than raw close + /// </summary> + public static DataTable GetTickersByOpenToCloseWinningDays( bool orderByASC, + string groupID, + DateTime firstQuoteDate, + DateTime lastQuoteDate, + long maxNumOfReturnedTickers, + bool onlyTickersWithAtLeastOneWinningDay) + { + return + GetTickersByOpenToCloseWinningDays(orderByASC, + QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers(groupID), + firstQuoteDate, + lastQuoteDate, + maxNumOfReturnedTickers, + onlyTickersWithAtLeastOneWinningDay); + } private static float[] getArrayOfCloseToOpenRatios(string ticker, *************** *** 411,420 **** if(tickerRatios.Length == benchmarkRatios.Length) row["OpenCloseCorrelationToBenchmark"] = ! BasicFunctions.PearsonCorrelationCoefficient(benchmarkRatios, tickerRatios); } DataTable tableToReturn = ExtendedDataTable.CopyAndSort(setOfTickers, ! "OpenCloseCorrelationToBenchmark > 0", ! "OpenCloseCorrelationToBenchmark", ! orderByASC); ExtendedDataTable.DeleteRows(tableToReturn, maxNumOfReturnedTickers); return tableToReturn; --- 438,447 ---- if(tickerRatios.Length == benchmarkRatios.Length) row["OpenCloseCorrelationToBenchmark"] = ! Math.Abs(BasicFunctions.PearsonCorrelationCoefficient(benchmarkRatios, tickerRatios)); } DataTable tableToReturn = ExtendedDataTable.CopyAndSort(setOfTickers, ! "OpenCloseCorrelationToBenchmark>=0.0", ! "OpenCloseCorrelationToBenchmark", ! orderByASC); ExtendedDataTable.DeleteRows(tableToReturn, maxNumOfReturnedTickers); return tableToReturn; |
|
From: Marco M. <mi...@us...> - 2005-09-18 21:03:51
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1539/b2_DataAccess/Tables Modified Files: Quotes.cs Log Message: GetTickersByOpenToCloseWinningDays has been moved to Quotes class in data layer. Added new parameter to the method. Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Quotes.cs 2 Jun 2005 18:06:17 -0000 1.26 --- Quotes.cs 18 Sep 2005 21:03:43 -0000 1.27 *************** *** 590,598 **** return SqlExecutor.GetDataTable( sql ); } ! /// <summary> /// returns tickers counting how many times raw close is greater than raw open /// for the given interval of days (within the given group of tickers). ! /// Tickers are ordered by the number of days raw open is greater than raw close /// </summary> public static DataTable GetTickersByOpenToCloseWinningDays( bool orderInASCMode, string groupID, --- 590,598 ---- return SqlExecutor.GetDataTable( sql ); } ! /*moved to Quotes inside data layer /// <summary> /// returns tickers counting how many times raw close is greater than raw open /// for the given interval of days (within the given group of tickers). ! /// Tickers are ordered by the number of days raw open is greater than raw close /// </summary> public static DataTable GetTickersByOpenToCloseWinningDays( bool orderInASCMode, string groupID, *************** *** 601,604 **** --- 601,605 ---- long maxNumOfReturnedTickers) { + string sql = "SELECT TOP " + maxNumOfReturnedTickers + " quotes.quTicker, tickers.tiCompanyName, " + "Count(quotes.quClose) AS CloseToOpenWinningDays " + *************** *** 617,621 **** return SqlExecutor.GetDataTable( sql ); } ! /// <summary> /// returns the average traded value for the given ticker in the specified interval --- 618,622 ---- return SqlExecutor.GetDataTable( sql ); } ! */ /// <summary> /// returns the average traded value for the given ticker in the specified interval *************** *** 811,815 **** DataTable dt; int returnValue = 0; ! string sql = "SELECT Count(quotes.quClose) AS CloseToOpenWinningDays " + "FROM quotes WHERE " + "quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + --- 812,816 ---- DataTable dt; int returnValue = 0; ! string sql = "SELECT Count(*) AS CloseToOpenWinningDays " + "FROM quotes WHERE " + "quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + |
|
From: Marco M. <mi...@us...> - 2005-09-18 20:53:25
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32312/Downloader/TickerSelectors Modified Files: TickerSelectorForm.cs Log Message: Added parameter to GetTickersByWinningOpenToClose method in Quotes class (data layer). Index: TickerSelectorForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerSelectorForm.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TickerSelectorForm.cs 24 Jun 2005 23:06:34 -0000 1.16 --- TickerSelectorForm.cs 18 Sep 2005 20:53:16 -0000 1.17 *************** *** 68,71 **** --- 68,72 ---- private System.Windows.Forms.TextBox textBoxMaxPrice; private System.Windows.Forms.Splitter splitter1; + private System.Windows.Forms.CheckBox checkBoxOnlyWithAtLeastOneWinningDay; private DataTable tableOfSelectedTickers; *************** *** 125,425 **** /// </summary> private void InitializeComponent() { ! this.components = new System.ComponentModel.Container(); ! this.splitter1 = new System.Windows.Forms.Splitter(); ! this.textBoxMaxPrice = new System.Windows.Forms.TextBox(); ! this.labelMaxPrice = new System.Windows.Forms.Label(); ! this.label5 = new System.Windows.Forms.Label(); ! this.labelMaxStdDev = new System.Windows.Forms.Label(); ! this.label7 = new System.Windows.Forms.Label(); ! this.textBoxMaxNumOfReturnedTickers = new System.Windows.Forms.TextBox(); ! this.panel2 = new System.Windows.Forms.Panel(); ! this.labelMinStdDev = new System.Windows.Forms.Label(); ! this.label3 = new System.Windows.Forms.Label(); ! this.comboBoxAvailableSelectionRules = new System.Windows.Forms.ComboBox(); ! this.textBoxMarketIndex = new System.Windows.Forms.TextBox(); ! this.textBoxGroupID = new System.Windows.Forms.TextBox(); ! this.label1 = new System.Windows.Forms.Label(); ! this.label2 = new System.Windows.Forms.Label(); ! this.dataGrid1 = new System.Windows.Forms.DataGrid(); ! this.labelMarketIndexKey = new System.Windows.Forms.Label(); ! this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); ! this.textBoxMaxStdDev = new System.Windows.Forms.TextBox(); ! this.dateTimePickerLastDate = new System.Windows.Forms.DateTimePicker(); ! this.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); ! this.groupBoxSelectionRule = new System.Windows.Forms.GroupBox(); ! this.checkBoxASCMode = new System.Windows.Forms.CheckBox(); ! this.buttonSelectTickers = new System.Windows.Forms.Button(); ! this.labelMinPrice = new System.Windows.Forms.Label(); ! this.textBoxMinStdDev = new System.Windows.Forms.TextBox(); ! this.textBoxMinPrice = new System.Windows.Forms.TextBox(); ! this.panel2.SuspendLayout(); ! ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); ! this.groupBoxSelectionRule.SuspendLayout(); ! this.SuspendLayout(); ! // ! // splitter1 ! // ! this.splitter1.BackColor = System.Drawing.SystemColors.Highlight; ! this.splitter1.Location = new System.Drawing.Point(432, 0); ! this.splitter1.Name = "splitter1"; ! this.splitter1.Size = new System.Drawing.Size(3, 478); ! this.splitter1.TabIndex = 8; ! this.splitter1.TabStop = false; ! // ! // textBoxMaxPrice ! // ! this.textBoxMaxPrice.Location = new System.Drawing.Point(72, 200); ! this.textBoxMaxPrice.Name = "textBoxMaxPrice"; ! this.textBoxMaxPrice.Size = new System.Drawing.Size(56, 20); ! this.textBoxMaxPrice.TabIndex = 32; ! this.textBoxMaxPrice.Text = ""; ! this.textBoxMaxPrice.Visible = false; ! // ! // labelMaxPrice ! // ! this.labelMaxPrice.Location = new System.Drawing.Point(16, 200); ! this.labelMaxPrice.Name = "labelMaxPrice"; ! this.labelMaxPrice.Size = new System.Drawing.Size(56, 23); ! this.labelMaxPrice.TabIndex = 33; ! this.labelMaxPrice.Text = "Max Price"; ! this.labelMaxPrice.Visible = false; ! // ! // label5 ! // ! this.label5.Location = new System.Drawing.Point(8, 24); ! this.label5.Name = "label5"; ! this.label5.Size = new System.Drawing.Size(64, 16); ! this.label5.TabIndex = 18; ! this.label5.Text = "First Date"; ! // ! // labelMaxStdDev ! // ! this.labelMaxStdDev.Location = new System.Drawing.Point(152, 200); ! this.labelMaxStdDev.Name = "labelMaxStdDev"; ! this.labelMaxStdDev.Size = new System.Drawing.Size(80, 23); ! this.labelMaxStdDev.TabIndex = 37; ! this.labelMaxStdDev.Text = "Max Std Dev"; ! this.labelMaxStdDev.Visible = false; ! // ! // label7 ! // ! this.label7.Location = new System.Drawing.Point(168, 24); ! this.label7.Name = "label7"; ! this.label7.Size = new System.Drawing.Size(64, 16); ! this.label7.TabIndex = 20; ! this.label7.Text = "Last Date"; ! // ! // textBoxMaxNumOfReturnedTickers ! // ! this.textBoxMaxNumOfReturnedTickers.Location = new System.Drawing.Point(312, 64); ! this.textBoxMaxNumOfReturnedTickers.Name = "textBoxMaxNumOfReturnedTickers"; ! this.textBoxMaxNumOfReturnedTickers.Size = new System.Drawing.Size(48, 20); ! this.textBoxMaxNumOfReturnedTickers.TabIndex = 23; ! this.textBoxMaxNumOfReturnedTickers.Text = ""; ! // ! // panel2 ! // ! this.panel2.Controls.Add(this.groupBoxSelectionRule); ! this.panel2.Controls.Add(this.buttonSelectTickers); ! this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; ! this.panel2.ForeColor = System.Drawing.SystemColors.ControlText; ! this.panel2.Location = new System.Drawing.Point(432, 0); ! this.panel2.Name = "panel2"; ! this.panel2.Size = new System.Drawing.Size(372, 478); ! this.panel2.TabIndex = 7; ! // ! // labelMinStdDev ! // ! this.labelMinStdDev.Location = new System.Drawing.Point(152, 152); ! this.labelMinStdDev.Name = "labelMinStdDev"; ! this.labelMinStdDev.Size = new System.Drawing.Size(72, 23); ! this.labelMinStdDev.TabIndex = 35; ! this.labelMinStdDev.Text = "Min Std Dev"; ! this.labelMinStdDev.Visible = false; ! // ! // label3 ! // ! this.label3.Location = new System.Drawing.Point(16, 96); ! this.label3.Name = "label3"; ! this.label3.Size = new System.Drawing.Size(120, 16); ! this.label3.TabIndex = 26; ! this.label3.Text = "Choose selection rule"; ! // ! // comboBoxAvailableSelectionRules ! // ! this.comboBoxAvailableSelectionRules.Location = new System.Drawing.Point(8, 120); ! this.comboBoxAvailableSelectionRules.Name = "comboBoxAvailableSelectionRules"; ! this.comboBoxAvailableSelectionRules.Size = new System.Drawing.Size(176, 21); ! this.comboBoxAvailableSelectionRules.TabIndex = 25; ! this.comboBoxAvailableSelectionRules.Text = "comboBox1"; ! this.comboBoxAvailableSelectionRules.SelectedValueChanged += new System.EventHandler(this.comboBoxAvailableSelectionRules_SelectedValueChanged); ! // ! // textBoxMarketIndex ! // ! this.textBoxMarketIndex.Location = new System.Drawing.Point(192, 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; ! // ! // textBoxGroupID ! // ! this.textBoxGroupID.Location = new System.Drawing.Point(72, 64); ! this.textBoxGroupID.Name = "textBoxGroupID"; ! this.textBoxGroupID.Size = new System.Drawing.Size(88, 20); ! this.textBoxGroupID.TabIndex = 21; ! this.textBoxGroupID.Text = ""; ! // ! // label1 ! // ! this.label1.Location = new System.Drawing.Point(8, 64); ! this.label1.Name = "label1"; ! this.label1.Size = new System.Drawing.Size(64, 16); ! this.label1.TabIndex = 22; ! this.label1.Text = "GroupID"; ! // ! // label2 ! // ! this.label2.Location = new System.Drawing.Point(160, 64); ! this.label2.Name = "label2"; ! this.label2.Size = new System.Drawing.Size(152, 24); ! this.label2.TabIndex = 24; ! this.label2.Text = "Max Num of returned tickers"; ! // ! // dataGrid1 ! // ! this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.None; ! this.dataGrid1.DataMember = ""; ! this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Left; ! this.dataGrid1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); ! this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dataGrid1.Location = new System.Drawing.Point(0, 0); ! this.dataGrid1.Name = "dataGrid1"; ! this.dataGrid1.Size = new System.Drawing.Size(432, 478); ! this.dataGrid1.TabIndex = 2; ! // ! // labelMarketIndexKey ! // ! this.labelMarketIndexKey.Location = new System.Drawing.Point(88, 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; ! // ! // textBoxMaxStdDev ! // ! this.textBoxMaxStdDev.Location = new System.Drawing.Point(232, 200); ! this.textBoxMaxStdDev.Name = "textBoxMaxStdDev"; ! this.textBoxMaxStdDev.Size = new System.Drawing.Size(56, 20); ! this.textBoxMaxStdDev.TabIndex = 36; ! this.textBoxMaxStdDev.Text = ""; ! this.textBoxMaxStdDev.Visible = false; ! // ! // dateTimePickerLastDate ! // ! this.dateTimePickerLastDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; ! this.dateTimePickerLastDate.Location = new System.Drawing.Point(240, 24); ! this.dateTimePickerLastDate.Name = "dateTimePickerLastDate"; ! this.dateTimePickerLastDate.Size = new System.Drawing.Size(88, 20); ! this.dateTimePickerLastDate.TabIndex = 15; ! // ! // dateTimePickerFirstDate ! // ! this.dateTimePickerFirstDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; ! this.dateTimePickerFirstDate.Location = new System.Drawing.Point(72, 24); ! this.dateTimePickerFirstDate.Name = "dateTimePickerFirstDate"; ! this.dateTimePickerFirstDate.Size = new System.Drawing.Size(88, 20); ! this.dateTimePickerFirstDate.TabIndex = 13; ! // ! // groupBoxSelectionRule ! // ! this.groupBoxSelectionRule.Controls.Add(this.labelMaxStdDev); ! this.groupBoxSelectionRule.Controls.Add(this.textBoxMaxStdDev); ! this.groupBoxSelectionRule.Controls.Add(this.labelMinStdDev); ! this.groupBoxSelectionRule.Controls.Add(this.textBoxMinStdDev); ! this.groupBoxSelectionRule.Controls.Add(this.labelMaxPrice); ! this.groupBoxSelectionRule.Controls.Add(this.textBoxMaxPrice); ! this.groupBoxSelectionRule.Controls.Add(this.labelMinPrice); ! this.groupBoxSelectionRule.Controls.Add(this.textBoxMinPrice); ! this.groupBoxSelectionRule.Controls.Add(this.labelMarketIndexKey); ! this.groupBoxSelectionRule.Controls.Add(this.textBoxMarketIndex); ! this.groupBoxSelectionRule.Controls.Add(this.checkBoxASCMode); ! this.groupBoxSelectionRule.Controls.Add(this.label3); ! this.groupBoxSelectionRule.Controls.Add(this.comboBoxAvailableSelectionRules); ! this.groupBoxSelectionRule.Controls.Add(this.label2); ! this.groupBoxSelectionRule.Controls.Add(this.textBoxMaxNumOfReturnedTickers); ! this.groupBoxSelectionRule.Controls.Add(this.label1); ! this.groupBoxSelectionRule.Controls.Add(this.textBoxGroupID); ! this.groupBoxSelectionRule.Controls.Add(this.label7); ! this.groupBoxSelectionRule.Controls.Add(this.label5); ! this.groupBoxSelectionRule.Controls.Add(this.dateTimePickerLastDate); ! this.groupBoxSelectionRule.Controls.Add(this.dateTimePickerFirstDate); ! this.groupBoxSelectionRule.Location = new System.Drawing.Point(8, 16); ! this.groupBoxSelectionRule.Name = "groupBoxSelectionRule"; ! this.groupBoxSelectionRule.Size = new System.Drawing.Size(376, 248); ! this.groupBoxSelectionRule.TabIndex = 14; ! this.groupBoxSelectionRule.TabStop = false; ! this.groupBoxSelectionRule.Text = "Single Selection rule"; ! // ! // checkBoxASCMode ! // ! this.checkBoxASCMode.Location = new System.Drawing.Point(200, 120); ! this.checkBoxASCMode.Name = "checkBoxASCMode"; ! this.checkBoxASCMode.Size = new System.Drawing.Size(152, 24); ! this.checkBoxASCMode.TabIndex = 27; ! this.checkBoxASCMode.Text = "Order by ASC mode"; ! // ! // buttonSelectTickers ! // ! this.buttonSelectTickers.Location = new System.Drawing.Point(136, 272); ! this.buttonSelectTickers.Name = "buttonSelectTickers"; ! this.buttonSelectTickers.Size = new System.Drawing.Size(104, 24); ! this.buttonSelectTickers.TabIndex = 3; ! this.buttonSelectTickers.Text = "Select Tickers"; ! this.buttonSelectTickers.Click += new System.EventHandler(this.buttonSelectTickers_Click); ! // ! // labelMinPrice ! // ! this.labelMinPrice.Location = new System.Drawing.Point(16, 152); ! this.labelMinPrice.Name = "labelMinPrice"; ! this.labelMinPrice.Size = new System.Drawing.Size(56, 23); ! this.labelMinPrice.TabIndex = 31; ! this.labelMinPrice.Text = "Min Price"; ! this.labelMinPrice.Visible = false; ! // ! // textBoxMinStdDev ! // ! this.textBoxMinStdDev.Location = new System.Drawing.Point(232, 152); ! this.textBoxMinStdDev.Name = "textBoxMinStdDev"; ! this.textBoxMinStdDev.Size = new System.Drawing.Size(56, 20); ! this.textBoxMinStdDev.TabIndex = 34; ! this.textBoxMinStdDev.Text = ""; ! this.textBoxMinStdDev.Visible = false; ! // ! // textBoxMinPrice ! // ! this.textBoxMinPrice.Location = new System.Drawing.Point(72, 152); ! this.textBoxMinPrice.Name = "textBoxMinPrice"; ! this.textBoxMinPrice.Size = new System.Drawing.Size(56, 20); ! this.textBoxMinPrice.TabIndex = 30; ! this.textBoxMinPrice.Text = ""; ! this.textBoxMinPrice.Visible = false; ! // ! // TickerSelectorForm ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(804, 478); ! this.Controls.Add(this.splitter1); ! this.Controls.Add(this.panel2); ! this.Controls.Add(this.dataGrid1); ! this.Name = "TickerSelectorForm"; ! this.Text = "Ticker Selector"; ! this.panel2.ResumeLayout(false); ! ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); ! this.groupBoxSelectionRule.ResumeLayout(false); ! this.ResumeLayout(false); ! } #endregion --- 126,441 ---- /// </summary> private void InitializeComponent() { ! this.components = new System.ComponentModel.Container(); ! this.splitter1 = new System.Windows.Forms.Splitter(); ! this.textBoxMaxPrice = new System.Windows.Forms.TextBox(); ! this.labelMaxPrice = new System.Windows.Forms.Label(); ! this.label5 = new System.Windows.Forms.Label(); ! this.labelMaxStdDev = new System.Windows.Forms.Label(); ! this.label7 = new System.Windows.Forms.Label(); ! this.textBoxMaxNumOfReturnedTickers = new System.Windows.Forms.TextBox(); ! this.panel2 = new System.Windows.Forms.Panel(); ! this.groupBoxSelectionRule = new System.Windows.Forms.GroupBox(); ! this.textBoxMaxStdDev = new System.Windows.Forms.TextBox(); ! this.labelMinStdDev = new System.Windows.Forms.Label(); ! this.textBoxMinStdDev = new System.Windows.Forms.TextBox(); ! this.labelMinPrice = new System.Windows.Forms.Label(); ! this.textBoxMinPrice = new System.Windows.Forms.TextBox(); ! this.labelMarketIndexKey = new System.Windows.Forms.Label(); ! this.textBoxMarketIndex = new System.Windows.Forms.TextBox(); ! this.checkBoxASCMode = new System.Windows.Forms.CheckBox(); ! this.label3 = new System.Windows.Forms.Label(); ! this.comboBoxAvailableSelectionRules = new System.Windows.Forms.ComboBox(); ! this.label2 = new System.Windows.Forms.Label(); ! this.label1 = new System.Windows.Forms.Label(); ! this.textBoxGroupID = new System.Windows.Forms.TextBox(); ! this.dateTimePickerLastDate = new System.Windows.Forms.DateTimePicker(); ! this.dateTimePickerFirstDate = new System.Windows.Forms.DateTimePicker(); ! this.buttonSelectTickers = new System.Windows.Forms.Button(); ! this.dataGrid1 = new System.Windows.Forms.DataGrid(); ! this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); ! this.checkBoxOnlyWithAtLeastOneWinningDay = new System.Windows.Forms.CheckBox(); ! this.panel2.SuspendLayout(); ! this.groupBoxSelectionRule.SuspendLayout(); ! ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); ! this.SuspendLayout(); ! // ! // splitter1 ! // ! this.splitter1.BackColor = System.Drawing.SystemColors.Highlight; ! this.splitter1.Location = new System.Drawing.Point(432, 0); ! this.splitter1.Name = "splitter1"; ! this.splitter1.Size = new System.Drawing.Size(3, 478); ! this.splitter1.TabIndex = 8; ! this.splitter1.TabStop = false; ! // ! // textBoxMaxPrice ! // ! this.textBoxMaxPrice.Location = new System.Drawing.Point(72, 232); ! this.textBoxMaxPrice.Name = "textBoxMaxPrice"; ! this.textBoxMaxPrice.Size = new System.Drawing.Size(56, 20); ! this.textBoxMaxPrice.TabIndex = 32; ! this.textBoxMaxPrice.Text = ""; ! this.textBoxMaxPrice.Visible = false; ! // ! // labelMaxPrice ! // ! this.labelMaxPrice.Location = new System.Drawing.Point(16, 232); ! this.labelMaxPrice.Name = "labelMaxPrice"; ! this.labelMaxPrice.Size = new System.Drawing.Size(56, 23); ! this.labelMaxPrice.TabIndex = 33; ! this.labelMaxPrice.Text = "Max Price"; ! this.labelMaxPrice.Visible = false; ! // ! // label5 ! // ! this.label5.Location = new System.Drawing.Point(8, 24); ! this.label5.Name = "label5"; ! this.label5.Size = new System.Drawing.Size(64, 16); ! this.label5.TabIndex = 18; ! this.label5.Text = "First Date"; ! // ! // labelMaxStdDev ! // ! this.labelMaxStdDev.Location = new System.Drawing.Point(152, 232); ! this.labelMaxStdDev.Name = "labelMaxStdDev"; ! this.labelMaxStdDev.Size = new System.Drawing.Size(80, 23); ! this.labelMaxStdDev.TabIndex = 37; ! this.labelMaxStdDev.Text = "Max Std Dev"; ! this.labelMaxStdDev.Visible = false; ! // ! // label7 ! // ! this.label7.Location = new System.Drawing.Point(168, 24); ! this.label7.Name = "label7"; ! this.label7.Size = new System.Drawing.Size(64, 16); ! this.label7.TabIndex = 20; ! this.label7.Text = "Last Date"; ! // ! // textBoxMaxNumOfReturnedTickers ! // ! this.textBoxMaxNumOfReturnedTickers.Location = new System.Drawing.Point(312, 64); ! this.textBoxMaxNumOfReturnedTickers.Name = "textBoxMaxNumOfReturnedTickers"; ! this.textBoxMaxNumOfReturnedTickers.Size = new System.Drawing.Size(48, 20); ! this.textBoxMaxNumOfReturnedTickers.TabIndex = 23; ! this.textBoxMaxNumOfReturnedTickers.Text = ""; ! // ! // panel2 ! // ! this.panel2.Controls.AddRange(new System.Windows.Forms.Control[] { ! this.groupBoxSelectionRule, ! this.buttonSelectTickers}); ! this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; ! this.panel2.ForeColor = System.Drawing.SystemColors.ControlText; ! this.panel2.Location = new System.Drawing.Point(432, 0); ! this.panel2.Name = "panel2"; ! this.panel2.Size = new System.Drawing.Size(372, 478); ! this.panel2.TabIndex = 7; ! // ! // groupBoxSelectionRule ! // ! this.groupBoxSelectionRule.Controls.AddRange(new System.Windows.Forms.Control[] { ! this.checkBoxOnlyWithAtLeastOneWinningDay, ! this.labelMaxStdDev, ! this.textBoxMaxStdDev, ! this.labelMinStdDev, ! this.textBoxMinStdDev, ! this.labelMaxPrice, ! this.textBoxMaxPrice, ! this.labelMinPrice, ! this.textBoxMinPrice, ! this.labelMarketIndexKey, ! this.textBoxMarketIndex, ! this.checkBoxASCMode, ! this.label3, ! this.comboBoxAvailableSelectionRules, ! this.label2, ! this.textBoxMaxNumOfReturnedTickers, ! this.label1, ! this.textBoxGroupID, ! this.label7, ! this.label5, ! this.dateTimePickerLastDate, ! this.dateTimePickerFirstDate}); ! this.groupBoxSelectionRule.Location = new System.Drawing.Point(8, 16); ! this.groupBoxSelectionRule.Name = "groupBoxSelectionRule"; ! this.groupBoxSelectionRule.Size = new System.Drawing.Size(376, 272); ! this.groupBoxSelectionRule.TabIndex = 14; ! this.groupBoxSelectionRule.TabStop = false; ! this.groupBoxSelectionRule.Text = "Single Selection rule"; ! // ! // textBoxMaxStdDev ! // ! this.textBoxMaxStdDev.Location = new System.Drawing.Point(232, 232); ! this.textBoxMaxStdDev.Name = "textBoxMaxStdDev"; ! this.textBoxMaxStdDev.Size = new System.Drawing.Size(56, 20); ! this.textBoxMaxStdDev.TabIndex = 36; ! this.textBoxMaxStdDev.Text = ""; ! this.textBoxMaxStdDev.Visible = false; ! // ! // labelMinStdDev ! // ! this.labelMinStdDev.Location = new System.Drawing.Point(152, 184); ! this.labelMinStdDev.Name = "labelMinStdDev"; ! this.labelMinStdDev.Size = new System.Drawing.Size(72, 23); ! this.labelMinStdDev.TabIndex = 35; ! this.labelMinStdDev.Text = "Min Std Dev"; ! this.labelMinStdDev.Visible = false; ! // ! // textBoxMinStdDev ! // ! this.textBoxMinStdDev.Location = new System.Drawing.Point(232, 184); ! this.textBoxMinStdDev.Name = "textBoxMinStdDev"; ! this.textBoxMinStdDev.Size = new System.Drawing.Size(56, 20); ! this.textBoxMinStdDev.TabIndex = 34; ! this.textBoxMinStdDev.Text = ""; ! this.textBoxMinStdDev.Visible = false; ! // ! // labelMinPrice ! // ! this.labelMinPrice.Location = new System.Drawing.Point(16, 184); ! this.labelMinPrice.Name = "labelMinPrice"; ! this.labelMinPrice.Size = new System.Drawing.Size(56, 23); ! this.labelMinPrice.TabIndex = 31; ! this.labelMinPrice.Text = "Min Price"; ! this.labelMinPrice.Visible = false; ! // ! // textBoxMinPrice ! // ! this.textBoxMinPrice.Location = new System.Drawing.Point(72, 184); ! this.textBoxMinPrice.Name = "textBoxMinPrice"; ! this.textBoxMinPrice.Size = new System.Drawing.Size(56, 20); ! this.textBoxMinPrice.TabIndex = 30; ! this.textBoxMinPrice.Text = ""; ! this.textBoxMinPrice.Visible = false; ! // ! // labelMarketIndexKey ! // ! this.labelMarketIndexKey.Location = new System.Drawing.Point(88, 208); ! 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; ! // ! // textBoxMarketIndex ! // ! this.textBoxMarketIndex.Location = new System.Drawing.Point(192, 208); ! this.textBoxMarketIndex.Name = "textBoxMarketIndex"; ! this.textBoxMarketIndex.Size = new System.Drawing.Size(88, 20); ! this.textBoxMarketIndex.TabIndex = 28; ! this.textBoxMarketIndex.Text = ""; ! this.textBoxMarketIndex.Visible = false; ! // ! // checkBoxASCMode ! // ! this.checkBoxASCMode.Location = new System.Drawing.Point(8, 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 ! // ! this.label3.Location = new System.Drawing.Point(16, 96); ! this.label3.Name = "label3"; ! this.label3.Size = new System.Drawing.Size(120, 16); ! this.label3.TabIndex = 26; ! this.label3.Text = "Choose selection rule"; ! // ! // comboBoxAvailableSelectionRules ! // ! this.comboBoxAvailableSelectionRules.Location = new System.Drawing.Point(8, 120); ! this.comboBoxAvailableSelectionRules.Name = "comboBoxAvailableSelectionRules"; ! this.comboBoxAvailableSelectionRules.Size = new System.Drawing.Size(176, 21); ! this.comboBoxAvailableSelectionRules.TabIndex = 25; ! this.comboBoxAvailableSelectionRules.Text = "comboBox1"; ! this.comboBoxAvailableSelectionRules.SelectedValueChanged += new System.EventHandler(this.comboBoxAvailableSelectionRules_SelectedValueChanged); ! // ! // label2 ! // ! this.label2.Location = new System.Drawing.Point(160, 64); ! this.label2.Name = "label2"; ! this.label2.Size = new System.Drawing.Size(152, 24); ! this.label2.TabIndex = 24; ! this.label2.Text = "Max Num of returned tickers"; ! // ! // label1 ! // ! this.label1.Location = new System.Drawing.Point(8, 64); ! this.label1.Name = "label1"; ! this.label1.Size = new System.Drawing.Size(64, 16); ! this.label1.TabIndex = 22; ! this.label1.Text = "GroupID"; ! // ! // textBoxGroupID ! // ! this.textBoxGroupID.Location = new System.Drawing.Point(72, 64); ! this.textBoxGroupID.Name = "textBoxGroupID"; ! this.textBoxGroupID.Size = new System.Drawing.Size(88, 20); ! this.textBoxGroupID.TabIndex = 21; ! this.textBoxGroupID.Text = ""; ! // ! // dateTimePickerLastDate ! // ! this.dateTimePickerLastDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; ! this.dateTimePickerLastDate.Location = new System.Drawing.Point(240, 24); ! this.dateTimePickerLastDate.Name = "dateTimePickerLastDate"; ! this.dateTimePickerLastDate.Size = new System.Drawing.Size(88, 20); ! this.dateTimePickerLastDate.TabIndex = 15; ! // ! // dateTimePickerFirstDate ! // ! this.dateTimePickerFirstDate.Format = System.Windows.Forms.DateTimePickerFormat.Short; ! this.dateTimePickerFirstDate.Location = new System.Drawing.Point(72, 24); ! this.dateTimePickerFirstDate.Name = "dateTimePickerFirstDate"; ! this.dateTimePickerFirstDate.Size = new System.Drawing.Size(88, 20); ! this.dateTimePickerFirstDate.TabIndex = 13; ! // ! // buttonSelectTickers ! // ! this.buttonSelectTickers.Location = new System.Drawing.Point(136, 296); ! this.buttonSelectTickers.Name = "buttonSelectTickers"; ! this.buttonSelectTickers.Size = new System.Drawing.Size(104, 24); ! this.buttonSelectTickers.TabIndex = 3; ! this.buttonSelectTickers.Text = "Select Tickers"; ! this.buttonSelectTickers.Click += new System.EventHandler(this.buttonSelectTickers_Click); ! // ! // dataGrid1 ! // ! this.dataGrid1.BorderStyle = System.Windows.Forms.BorderStyle.None; ! this.dataGrid1.DataMember = ""; ! this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Left; ! this.dataGrid1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); ! this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dataGrid1.Name = "dataGrid1"; ! this.dataGrid1.Size = new System.Drawing.Size(432, 478); ! this.dataGrid1.TabIndex = 2; ! // ! // checkBoxOnlyWithAtLeastOneWinningDay ! // ! this.checkBoxOnlyWithAtLeastOneWinningDay.Enabled = false; ! this.checkBoxOnlyWithAtLeastOneWinningDay.Location = new System.Drawing.Point(192, 144); ! this.checkBoxOnlyWithAtLeastOneWinningDay.Name = "checkBoxOnlyWithAtLeastOneWinningDay"; ! this.checkBoxOnlyWithAtLeastOneWinningDay.Size = new System.Drawing.Size(152, 24); ! this.checkBoxOnlyWithAtLeastOneWinningDay.TabIndex = 38; ! this.checkBoxOnlyWithAtLeastOneWinningDay.Text = "Exclude \"pure\" losers"; ! this.toolTip1.SetToolTip(this.checkBoxOnlyWithAtLeastOneWinningDay, "Check if you want to filter only tickers with at least one winning day"); ! // ! // TickerSelectorForm ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(804, 478); ! this.Controls.AddRange(new System.Windows.Forms.Control[] { ! this.splitter1, ! this.panel2, ! this.dataGrid1}); ! this.Name = "TickerSelectorForm"; ! this.Text = "Ticker Selector"; ! this.panel2.ResumeLayout(false); ! this.groupBoxSelectionRule.ResumeLayout(false); ! ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit(); ! this.ResumeLayout(false); ! ! } #endregion *************** *** 587,595 **** returnValue = new SelectorByWinningOpenToClose(this.textBoxGroupID.Text, this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); else returnValue = new SelectorByWinningOpenToClose(this.tableOfSelectedTickers, this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text)); } else if (this.comboBoxAvailableSelectionRules.Text == "OpenCloseCorrelationToBenchmark") --- 603,613 ---- returnValue = new SelectorByWinningOpenToClose(this.textBoxGroupID.Text, this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text), ! this.checkBoxOnlyWithAtLeastOneWinningDay.Checked); else returnValue = new SelectorByWinningOpenToClose(this.tableOfSelectedTickers, this.checkBoxASCMode.Checked, this.dateTimePickerFirstDate.Value, ! this.dateTimePickerLastDate.Value, Int32.Parse(this.textBoxMaxNumOfReturnedTickers.Text), ! this.checkBoxOnlyWithAtLeastOneWinningDay.Checked); } else if (this.comboBoxAvailableSelectionRules.Text == "OpenCloseCorrelationToBenchmark") *************** *** 613,616 **** --- 631,639 ---- this.textBoxMarketIndex.Visible = showControls; } + private void setVisibilityForControls_WinningOpenToClose(bool showControls) + { + this.checkBoxASCMode.Enabled = showControls; + this.checkBoxOnlyWithAtLeastOneWinningDay.Enabled = showControls; + } private void setVisibilityForControls_AverageRawOpenPrice(bool showControls) { *************** *** 631,635 **** this.comboBoxAvailableSelectionRules.Text == "OpenCloseCorrelationToBenchmark") { ! this.setVisibilityForControls_QuotedAtEachMarketDay(true); } else if(this.comboBoxAvailableSelectionRules.Text == "AverageRawOpenPrice") --- 654,660 ---- this.comboBoxAvailableSelectionRules.Text == "OpenCloseCorrelationToBenchmark") { ! this.setVisibilityForControls_AverageRawOpenPrice(false); ! this.setVisibilityForControls_WinningOpenToClose(false); ! this.setVisibilityForControls_QuotedAtEachMarketDay(true); } else if(this.comboBoxAvailableSelectionRules.Text == "AverageRawOpenPrice") *************** *** 637,642 **** --- 662,675 ---- this.textBoxMarketIndex.Text = ""; this.setVisibilityForControls_QuotedAtEachMarketDay(false); + this.setVisibilityForControls_WinningOpenToClose(false); this.setVisibilityForControls_AverageRawOpenPrice(true); } + else if(this.comboBoxAvailableSelectionRules.Text == "WinningOpenToClose") + { + this.textBoxMarketIndex.Text = ""; + this.setVisibilityForControls_QuotedAtEachMarketDay(false); + this.setVisibilityForControls_AverageRawOpenPrice(false); + this.setVisibilityForControls_WinningOpenToClose(true); + } else { *************** *** 644,647 **** --- 677,682 ---- this.setVisibilityForControls_QuotedAtEachMarketDay(false); this.setVisibilityForControls_AverageRawOpenPrice(false); + this.setVisibilityForControls_WinningOpenToClose(false); + this.checkBoxASCMode.Enabled = true; } } |
|
From: Marco M. <mi...@us...> - 2005-09-11 15:38:53
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18997/b2_DataAccess/Tables Modified Files: Tickers.cs Log Message: Added method GetFilteredTickers on overload for filtering tickers (for the TickerViewer object). Index: Tickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Tickers.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Tickers.cs 20 Jan 2005 19:13:33 -0000 1.4 --- Tickers.cs 11 Sep 2005 15:38:44 -0000 1.5 *************** *** 83,86 **** --- 83,105 ---- } + public static DataTable GetTableOfFilteredTickers(string tickerSymbolIsLike, + string tickerCompanyNameIsLike, + string firstOperatorInHavingStatement, + DateTime firstQuoteDate, + string secondOperatorInHavingStatement, + DateTime lastQuoteDate, + string groupID) + { + string sqlSelectString = Tickers.buildSqlSelectString(tickerSymbolIsLike, + tickerCompanyNameIsLike, + firstOperatorInHavingStatement, + firstQuoteDate, + secondOperatorInHavingStatement, + lastQuoteDate, + groupID); + return SqlExecutor.GetDataTable(sqlSelectString); + } + + #region buildSqlSelectString private static string buildSqlSelectString(string tickerSymbolIsLike, *************** *** 97,100 **** --- 116,148 ---- } + private static string buildSqlSelectString_getHavingStatement(string firstOperatorInHavingStatement, + string secondOperatorInHavingStatement, + DateTime firstQuoteDate, + DateTime lastQuoteDate) + { + string returnValue; + if(firstOperatorInHavingStatement == "" && + secondOperatorInHavingStatement == "") + returnValue = ""; + else if(firstOperatorInHavingStatement == "" && + secondOperatorInHavingStatement != "") + returnValue = "HAVING Max(quotes.quDate)" + secondOperatorInHavingStatement + + SQLBuilder.GetDateConstant(lastQuoteDate); + else if(firstOperatorInHavingStatement != "" && + secondOperatorInHavingStatement == "") + returnValue = "HAVING Min(quotes.quDate)" + firstOperatorInHavingStatement + + SQLBuilder.GetDateConstant(firstQuoteDate); + else + { + if(firstQuoteDate.CompareTo(lastQuoteDate)>0) + throw new Exception("Last Date can't be previous of First date!"); + returnValue = "HAVING Min(quotes.quDate)" + firstOperatorInHavingStatement + + SQLBuilder.GetDateConstant(firstQuoteDate) + + "AND Max(quotes.quDate)" + secondOperatorInHavingStatement + + SQLBuilder.GetDateConstant(lastQuoteDate); + } + return returnValue; + } + private static string buildSqlSelectString(string tickerSymbolIsLike, string tickerCompanyNameIsLike, *************** *** 105,110 **** { string sqlSelectString = ""; ! if(firstQuoteDate.CompareTo(lastQuoteDate)>0) ! throw new Exception("Last Date can't be previous of First date!"); sqlSelectString = "SELECT tiTicker, tiCompanyName, " + "Min(quotes.quDate) AS FirstQuote, Max(quotes.quDate) AS LastQuote, Count(quotes.quDate) AS NumberOfQuotes " + --- 153,157 ---- { string sqlSelectString = ""; ! sqlSelectString = "SELECT tiTicker, tiCompanyName, " + "Min(quotes.quDate) AS FirstQuote, Max(quotes.quDate) AS LastQuote, Count(quotes.quDate) AS NumberOfQuotes " + *************** *** 115,126 **** tickerCompanyNameIsLike + "' " + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + ! "HAVING Min(quotes.quDate)" + firstOperatorInHavingStatement + ! SQLBuilder.GetDateConstant(firstQuoteDate) + ! "AND Max(quotes.quDate)" + secondOperatorInHavingStatement + ! SQLBuilder.GetDateConstant(lastQuoteDate); return sqlSelectString; } ! #endregion --- 162,208 ---- tickerCompanyNameIsLike + "' " + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + ! buildSqlSelectString_getHavingStatement(firstOperatorInHavingStatement, ! secondOperatorInHavingStatement, ! firstQuoteDate, lastQuoteDate); return sqlSelectString; } ! private static string buildSqlSelectString(string tickerSymbolIsLike, ! string tickerCompanyNameIsLike, ! string firstOperatorInHavingStatement, ! DateTime firstQuoteDate, ! string secondOperatorInHavingStatement, ! DateTime lastQuoteDate, ! string groupID) ! { ! string sqlSelectString = ""; ! if(groupID == "") ! //no group has been selected ! { ! sqlSelectString = buildSqlSelectString(tickerSymbolIsLike, ! tickerCompanyNameIsLike, ! firstOperatorInHavingStatement, ! firstQuoteDate, ! secondOperatorInHavingStatement, ! lastQuoteDate); ! } ! else ! { ! sqlSelectString = "SELECT tiTicker, tiCompanyName, " + ! "Min(quotes.quDate) AS FirstQuote, Max(quotes.quDate) AS LastQuote, Count(quotes.quDate) AS NumberOfQuotes " + ! "FROM (tickers_tickerGroups LEFT JOIN tickers ON tickers_tickerGroups.ttTiId = tickers.tiTicker) LEFT JOIN quotes ON tickers.tiTicker = quotes.quTicker " + ! "WHERE tiTicker LIKE '" + ! tickerSymbolIsLike + "' " + ! "AND tiCompanyName LIKE '" + ! tickerCompanyNameIsLike + "' " + ! "AND ttTgId ='" + ! groupID + "' " + ! "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + ! buildSqlSelectString_getHavingStatement(firstOperatorInHavingStatement, ! secondOperatorInHavingStatement, ! firstQuoteDate, lastQuoteDate); ! } ! return sqlSelectString; ! } #endregion |
|
From: Marco M. <mi...@us...> - 2005-09-11 15:36:10
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18632/Downloader/TickerSelectors Modified Files: TickerViewer.cs Log Message: Added filter on group. Now, it is also possible to skip one or more filters by choosing null values in combo boxes. Index: TickerViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/TickerSelectors/TickerViewer.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TickerViewer.cs 13 Feb 2005 11:44:51 -0000 1.6 --- TickerViewer.cs 11 Sep 2005 15:36:02 -0000 1.7 *************** *** 32,35 **** --- 32,36 ---- using QuantProject.Data.DataTables; using QuantProject.Data.Selectors; + using QuantProject.ADT; namespace QuantProject.Applications.Downloader.TickerSelectors *************** *** 64,70 **** private System.Windows.Forms.Button buttonViewFaultyTickers; private System.Windows.Forms.Label label4; private bool skipRowChangedEvent;// event must be launched only by // user's changes ! public TickerViewer() { InitializeComponent(); --- 65,74 ---- private System.Windows.Forms.Button buttonViewFaultyTickers; private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.ComboBox comboBoxBelongingGroup; private bool skipRowChangedEvent;// event must be launched only by // user's changes ! ! public TickerViewer() { InitializeComponent(); *************** *** 73,76 **** --- 77,81 ---- this.dataGrid1.DataSource = this.tableTickers; this.AcceptButton = this.buttonFindTickers; + } *************** *** 106,110 **** --- 111,119 ---- this.label2 = new System.Windows.Forms.Label(); this.panel2 = new System.Windows.Forms.Panel(); + this.label4 = new System.Windows.Forms.Label(); + this.buttonViewFaultyTickers = new System.Windows.Forms.Button(); this.groupBoxDateQuoteFilter = new System.Windows.Forms.GroupBox(); + this.comboBoxBelongingGroup = new System.Windows.Forms.ComboBox(); + this.label8 = new System.Windows.Forms.Label(); this.comboBoxSecondOperator = new System.Windows.Forms.ComboBox(); this.comboBoxFirstOperator = new System.Windows.Forms.ComboBox(); *************** *** 117,122 **** this.radioButtonAnyTicker = new System.Windows.Forms.RadioButton(); this.splitter1 = new System.Windows.Forms.Splitter(); - this.buttonViewFaultyTickers = new System.Windows.Forms.Button(); - this.label4 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); this.panel2.SuspendLayout(); --- 126,129 ---- *************** *** 164,168 **** // buttonFindTickers // ! this.buttonFindTickers.Location = new System.Drawing.Point(152, 224); this.buttonFindTickers.Name = "buttonFindTickers"; this.buttonFindTickers.Size = new System.Drawing.Size(104, 24); --- 171,175 ---- // buttonFindTickers // ! this.buttonFindTickers.Location = new System.Drawing.Point(152, 264); this.buttonFindTickers.Name = "buttonFindTickers"; this.buttonFindTickers.Size = new System.Drawing.Size(104, 24); *************** *** 207,213 **** --- 214,240 ---- this.panel2.TabIndex = 7; // + // label4 + // + this.label4.Location = new System.Drawing.Point(24, 304); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(352, 16); + this.label4.TabIndex = 16; + this.label4.Text = "________________________________________"; + this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // buttonViewFaultyTickers + // + this.buttonViewFaultyTickers.Location = new System.Drawing.Point(144, 336); + this.buttonViewFaultyTickers.Name = "buttonViewFaultyTickers"; + this.buttonViewFaultyTickers.Size = new System.Drawing.Size(120, 24); + this.buttonViewFaultyTickers.TabIndex = 15; + this.buttonViewFaultyTickers.Text = "&View faulty Tickers"; + this.buttonViewFaultyTickers.Click += new System.EventHandler(this.buttonViewFaultyTickers_Click); + // // groupBoxDateQuoteFilter // this.groupBoxDateQuoteFilter.Controls.AddRange(new System.Windows.Forms.Control[] { + this.comboBoxBelongingGroup, + this.label8, this.comboBoxSecondOperator, this.comboBoxFirstOperator, *************** *** 221,233 **** this.groupBoxDateQuoteFilter.Location = new System.Drawing.Point(8, 80); this.groupBoxDateQuoteFilter.Name = "groupBoxDateQuoteFilter"; ! this.groupBoxDateQuoteFilter.Size = new System.Drawing.Size(384, 136); this.groupBoxDateQuoteFilter.TabIndex = 14; this.groupBoxDateQuoteFilter.TabStop = false; this.groupBoxDateQuoteFilter.Text = "Quote filter"; // // comboBoxSecondOperator // this.comboBoxSecondOperator.Enabled = false; this.comboBoxSecondOperator.Items.AddRange(new object[] { "<=", ">="}); --- 248,279 ---- this.groupBoxDateQuoteFilter.Location = new System.Drawing.Point(8, 80); this.groupBoxDateQuoteFilter.Name = "groupBoxDateQuoteFilter"; ! this.groupBoxDateQuoteFilter.Size = new System.Drawing.Size(384, 168); this.groupBoxDateQuoteFilter.TabIndex = 14; this.groupBoxDateQuoteFilter.TabStop = false; this.groupBoxDateQuoteFilter.Text = "Quote filter"; // + // comboBoxBelongingGroup + // + this.comboBoxBelongingGroup.Enabled = false; + this.comboBoxBelongingGroup.Location = new System.Drawing.Point(200, 128); + this.comboBoxBelongingGroup.Name = "comboBoxBelongingGroup"; + this.comboBoxBelongingGroup.Size = new System.Drawing.Size(176, 21); + this.comboBoxBelongingGroup.TabIndex = 24; + this.comboBoxBelongingGroup.Text = "comboBox1"; + // + // label8 + // + this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); + this.label8.Location = new System.Drawing.Point(24, 136); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(120, 16); + this.label8.TabIndex = 23; + this.label8.Text = "belonging to group"; + // // comboBoxSecondOperator // this.comboBoxSecondOperator.Enabled = false; this.comboBoxSecondOperator.Items.AddRange(new object[] { + "", "<=", ">="}); *************** *** 236,240 **** this.comboBoxSecondOperator.Size = new System.Drawing.Size(48, 21); this.comboBoxSecondOperator.TabIndex = 22; ! this.comboBoxSecondOperator.Text = "<="; // // comboBoxFirstOperator --- 282,286 ---- this.comboBoxSecondOperator.Size = new System.Drawing.Size(48, 21); this.comboBoxSecondOperator.TabIndex = 22; ! this.comboBoxSecondOperator.SelectedValueChanged += new System.EventHandler(this.comboBoxSecondOperator_SelectedValueChanged); // // comboBoxFirstOperator *************** *** 242,245 **** --- 288,292 ---- this.comboBoxFirstOperator.Enabled = false; this.comboBoxFirstOperator.Items.AddRange(new object[] { + "", "<=", ">="}); *************** *** 248,252 **** this.comboBoxFirstOperator.Size = new System.Drawing.Size(48, 21); this.comboBoxFirstOperator.TabIndex = 21; ! this.comboBoxFirstOperator.Text = ">="; // // label7 --- 295,299 ---- this.comboBoxFirstOperator.Size = new System.Drawing.Size(48, 21); this.comboBoxFirstOperator.TabIndex = 21; ! this.comboBoxFirstOperator.SelectedValueChanged += new System.EventHandler(this.comboBoxFirstOperator_SelectedValueChanged); // // label7 *************** *** 321,342 **** this.splitter1.TabStop = false; // - // buttonViewFaultyTickers - // - this.buttonViewFaultyTickers.Location = new System.Drawing.Point(144, 296); - this.buttonViewFaultyTickers.Name = "buttonViewFaultyTickers"; - this.buttonViewFaultyTickers.Size = new System.Drawing.Size(120, 24); - this.buttonViewFaultyTickers.TabIndex = 15; - this.buttonViewFaultyTickers.Text = "&View faulty Tickers"; - this.buttonViewFaultyTickers.Click += new System.EventHandler(this.buttonViewFaultyTickers_Click); - // - // label4 - // - this.label4.Location = new System.Drawing.Point(24, 264); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(352, 16); - this.label4.TabIndex = 16; - this.label4.Text = "________________________________________"; - this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // // TickerViewer // --- 368,371 ---- *************** *** 496,501 **** else //all tickers with first date quote and last date quote within a specified interval { ! this.tableTickers = Tickers.GetTableOfFilteredTickers(this.textBoxStringToFind.Text, this.textBoxStringToFindInName.Text, this.comboBoxFirstOperator.Text, --- 525,533 ---- else //all tickers with first date quote and last date quote within a specified interval + //(and, if specified, belonging to a given group) { ! if(((string)this.comboBoxBelongingGroup.SelectedValue).Length == 0) ! //no group has been selected ! this.tableTickers = Tickers.GetTableOfFilteredTickers(this.textBoxStringToFind.Text, this.textBoxStringToFindInName.Text, this.comboBoxFirstOperator.Text, *************** *** 503,506 **** --- 535,546 ---- this.comboBoxSecondOperator.Text, this.dateTimePickerLastDate.Value); + else + this.tableTickers = Tickers.GetTableOfFilteredTickers(this.textBoxStringToFind.Text, + this.textBoxStringToFindInName.Text, + this.comboBoxFirstOperator.Text, + this.dateTimePickerFirstDate.Value, + this.comboBoxSecondOperator.Text, + this.dateTimePickerLastDate.Value, + (string)this.comboBoxBelongingGroup.SelectedValue); this.dataGrid1.DataSource = this.tableTickers; this.setStyle_dataGridWithQuoteInfo(); *************** *** 552,564 **** } } private void radioButtonDateQuoteFilter_CheckedChanged(object sender, System.EventArgs e) { if(this.radioButtonDateQuoteFilter.Checked == true) { - this.dateTimePickerFirstDate.Enabled = true; - this.dateTimePickerLastDate.Enabled = true; this.comboBoxFirstOperator.Enabled = true; this.comboBoxSecondOperator.Enabled = true; } else --- 592,624 ---- } } + private void radioButtonDateQuoteFilter_checkedChanged_fillComboBoxBelongingGroup() + { + if(this.comboBoxBelongingGroup.DataSource == null) + //data source not set yet + { + DataTable groups = SqlExecutor.GetDataTable("SELECT tgId AS GroupID, tgDescription AS GroupDescription FROM tickerGroups " + + "UNION " + + "SELECT '' AS GroupID, '' AS GroupDescription FROM tickerGroups " + + "ORDER BY GroupDescription"); + this.comboBoxBelongingGroup.DataSource = groups; + this.comboBoxBelongingGroup.DisplayMember = "GroupDescription"; + this.comboBoxBelongingGroup.ValueMember = "GroupID"; + } + + } private void radioButtonDateQuoteFilter_CheckedChanged(object sender, System.EventArgs e) { if(this.radioButtonDateQuoteFilter.Checked == true) { this.comboBoxFirstOperator.Enabled = true; + this.comboBoxFirstOperator.Text = ""; this.comboBoxSecondOperator.Enabled = true; + this.comboBoxSecondOperator.Text = ""; + this.comboBoxBelongingGroup.Enabled = true; + this.radioButtonDateQuoteFilter_checkedChanged_fillComboBoxBelongingGroup(); + this.comboBoxBelongingGroup.Text = ""; + + } else *************** *** 568,571 **** --- 628,632 ---- this.comboBoxFirstOperator.Enabled = false; this.comboBoxSecondOperator.Enabled = false; + this.comboBoxBelongingGroup.Enabled = false; } } *************** *** 658,661 **** --- 719,738 ---- } + private void comboBoxFirstOperator_SelectedValueChanged(object sender, System.EventArgs e) + { + if(this.comboBoxFirstOperator.Text.Length > 0) + this.dateTimePickerFirstDate.Enabled = true; + else + this.dateTimePickerFirstDate.Enabled = false; + } + + private void comboBoxSecondOperator_SelectedValueChanged(object sender, System.EventArgs e) + { + if(this.comboBoxSecondOperator.Text.Length > 0) + this.dateTimePickerLastDate.Enabled = true; + else + this.dateTimePickerLastDate.Enabled = false; + } + } |
|
From: Marco M. <mi...@us...> - 2005-09-07 06:48:09
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21749/b2_DataAccess Modified Files: DataAccess.prjx Log Message: Updated #develop projects files. Index: DataAccess.prjx =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataAccess.prjx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DataAccess.prjx 17 Mar 2005 18:45:02 -0000 1.1 --- DataAccess.prjx 7 Sep 2005 06:48:02 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- <File name=".\Tables\ValidatedTickers.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> <File name=".\Tables\VisuallyValidatedQuotes.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> + <File name=".\Tables\EventType.cs" subtype="Code" buildaction="Compile" dependson="" data="" /> </Contents> <References> |
|
From: Marco M. <mi...@us...> - 2005-09-07 06:45:24
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21377/b2_DataAccess/Tables Modified Files: Tickers_tickerGroups.cs Log Message: Fixed bug in GetTickers method Index: Tickers_tickerGroups.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Tickers_tickerGroups.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Tickers_tickerGroups.cs 27 Aug 2005 19:20:26 -0000 1.6 --- Tickers_tickerGroups.cs 7 Sep 2005 06:45:17 -0000 1.7 *************** *** 136,153 **** } - private static void getTickers_createView(string viewName, - string sqlStatement) - { - try - { - string sqlForViewCreation = "CREATE VIEW " + viewName + " AS " + sqlStatement; - SqlExecutor.ExecuteNonQuery(sqlForViewCreation); - } - catch(Exception ex) - { - ex = ex; - } - } - /// <summary> /// It returns a table containing tickers effectively contained --- 136,139 ---- *************** *** 157,182 **** { ! string sqlLastEntries = "SELECT tickers_tickerGroups.ttTgId AS GroupIDEntries, " + ! "tickers_tickerGroups.ttTiId AS TickerIDEntries, Max(tickers_tickerGroups.ttEventDate) " + ! "AS MaxEntryDate FROM tickers_tickerGroups WHERE " + ! "tickers_tickerGroups.ttEventType='I' " + ! "GROUP BY tickers_tickerGroups.ttTgId, tickers_tickerGroups.ttTiId"; ! getTickers_createView("Entries", sqlLastEntries); ! ! string sqlLastExits = "SELECT tickers_tickerGroups.ttTgId AS GroupIDExits, " + ! "tickers_tickerGroups.ttTiId AS TickerIDExits, Max(tickers_tickerGroups.ttEventDate) " + ! "AS MaxExitDate FROM tickers_tickerGroups WHERE " + ! "tickers_tickerGroups.ttEventType='O' " + ! "GROUP BY tickers_tickerGroups.ttTgId, tickers_tickerGroups.ttTiId"; ! ! getTickers_createView("Exits", sqlLastExits); ! ! string sqlTickersAtTheGivenDate = "SELECT GroupIDEntries, " + ! "TickerIDEntries FROM Entries LEFT JOIN Exits " + ! "ON (Entries.GroupIDEntries = Exits.GroupIDExits) AND " + ! "(Entries.TickerIDEntries = Exits.TickerIDExits) WHERE " + ! "GroupIDEntries ='" + groupID + "' AND " + ! "MaxEntryDate<=" + SQLBuilder.GetDateConstant(date) + " AND " + ! "(MaxExitDate Is Null OR MaxEntryDate>Exits.MaxExitDate)"; return SqlExecutor.GetDataTable(sqlTickersAtTheGivenDate); --- 143,154 ---- { ! string sqlTickersAtTheGivenDate = "SELECT ttTiId AS TickerID FROM tickers_tickerGroups " + ! "WHERE ttTgId='" + groupID + "' AND " + ! "ttEventDate<=" + SQLBuilder.GetDateConstant(date) + " " + ! "GROUP BY ttTiId " + ! "HAVING Right(Max(Year([ttEventDate]) & " + ! "IIf(Month([ttEventDate])<10,'0' & Month([ttEventDate]),Month([ttEventDate])) & " + ! "IIf(Day([ttEventDate])<10,'0' & Day([ttEventDate]),Day([ttEventDate])) & " + ! "[ttEventType]),1)='I'"; return SqlExecutor.GetDataTable(sqlTickersAtTheGivenDate); |
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:58:39
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11555/b4_Business/a1_Financial/a2_Accounting/h5_Reporting Modified Files: AccountReport.cs Log Message: SetEquityLine method has been added: it creates the equity line in a faster way than if it is created by the Create method Index: AccountReport.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/AccountReport.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** AccountReport.cs 26 May 2005 23:32:23 -0000 1.14 --- AccountReport.cs 3 Sep 2005 23:58:31 -0000 1.15 *************** *** 253,263 **** this.benchmarkEquityLine.Interpolate( this.EquityHistory.Keys , new PreviousInterpolator() ); } ! public AccountReport Create( string reportName , long numDaysForInterval , ! EndOfDayDateTime endDateTime , string benchmark ) ! { ! this.reportName = reportName; ! this.endDateTime = endDateTime; this.benchmark = benchmark; ! detailedDataTable = getDetailedDataTable( numDaysForInterval ); this.transactionTable = new Tables.Transactions( reportName , detailedDataTable ); // this.transactionTable = getTransactionTable( reportName , detailedDataTable ); --- 253,284 ---- this.benchmarkEquityLine.Interpolate( this.EquityHistory.Keys , new PreviousInterpolator() ); } ! private void setDetailedDataTable( long numDaysForInterval ) ! { ! if ( this.detailedDataTable == null ) ! // the detailedDataTable has not been computed yet ! this.detailedDataTable = ! this.getDetailedDataTable( numDaysForInterval ); ! } ! /// <summary> ! /// Creates the equity line in a faster way than if it is created ! /// by the Create method ! /// </summary> ! /// <param name="numDaysForInterval"></param> ! /// <param name="endDateTime"></param> ! /// <returns></returns> ! public void SetEquityLine( long numDaysForInterval , ! EndOfDayDateTime endDateTime ) ! { ! this.endDateTime = endDateTime; ! this.setDetailedDataTable( numDaysForInterval ); ! this.equity = new Tables.Equity( reportName , detailedDataTable ); ! } ! public AccountReport Create( string reportName , long numDaysForInterval , ! EndOfDayDateTime endDateTime , string benchmark ) ! { ! this.reportName = reportName; ! this.endDateTime = endDateTime; this.benchmark = benchmark; ! this.setDetailedDataTable( numDaysForInterval ); this.transactionTable = new Tables.Transactions( reportName , detailedDataTable ); // this.transactionTable = getTransactionTable( reportName , detailedDataTable ); |
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:56:34
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11230/b1_ADT/Statistics Modified Files: AdvancedFunctions.cs Log Message: GetSharpeRatio method has been added Index: AdvancedFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/AdvancedFunctions.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AdvancedFunctions.cs 24 Jun 2005 22:32:10 -0000 1.1 --- AdvancedFunctions.cs 3 Sep 2005 23:56:26 -0000 1.2 *************** *** 22,25 **** --- 22,26 ---- using System; + using System.Collections; namespace QuantProject.ADT.Statistics *************** *** 116,119 **** --- 117,127 ---- } + public static double GetSharpeRatio( ICollection returns ) + { + double sharpeRatio = + BasicFunctions.GetSimpleAverage( returns ) / + BasicFunctions.GetStdDev( returns ); + return sharpeRatio; + } } |
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:55:14
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10972/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Added Files: SharpeRatio.cs Log Message: Summary row containing the Sharpe Ratio calculation for the account report equity line --- NEW FILE: SharpeRatio.cs --- /* QuantProject - Quantitative Finance Library SharpeRatio.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; using System.Collections; using QuantProject.ADT.Histories; using QuantProject.ADT.Statistics; using QuantProject.Business.Financial.Accounting.Reporting.Tables; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// Summary row containing the Sharpe Ratio calculation for /// the account report equity line /// </summary> [Serializable] public class SharpeRatio : DoubleSummaryRow { private ArrayList getReturns( History equityLine ) { ArrayList returnValue = new ArrayList(); for ( int i=0 ; i < equityLine.Count - 1 ; i++ ) { if ( Convert.ToDouble( equityLine.GetByIndex( i ) ) <= 0 ) throw new Exception( "Equity line is expected to always being " + "strictly positive. equityLine[ i ] is negative or equal to zero!" ); double periodReturn = ( Convert.ToDouble( equityLine.GetByIndex( i + 1 ) ) - Convert.ToDouble( equityLine.GetByIndex( i ) ) ) / Convert.ToDouble( equityLine.GetByIndex( i ) ); returnValue.Add( periodReturn ); } return returnValue; } public SharpeRatio( History equityLine ) : base( 2 ) { this.rowDescription = "Sharpe ratio"; ICollection returns = this.getReturns( equityLine ); this.rowValue = AdvancedFunctions.GetSharpeRatio( returns ); } } } |
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:54:31
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10870/b4_Business Modified Files: b4_Business.csproj Log Message: a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\SharpeRatio.cs has been added Index: b4_Business.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/b4_Business.csproj,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** b4_Business.csproj 2 Aug 2005 23:04:03 -0000 1.26 --- b4_Business.csproj 3 Sep 2005 23:54:24 -0000 1.27 *************** *** 433,436 **** --- 433,441 ---- /> <File + RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\SharpeRatio.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\SummaryRow.cs" SubType = "Code" |
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:53:25
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Statistics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10648/b1_ADT/Statistics Modified Files: BasicFunctions.cs Log Message: - GetSum (for an ICollection) has been added - GetSimpleAverage (for an ICollection) has been added - GetVariance (for an ICollection) has been added - GetStdDev (for an ICollection) has been added Index: BasicFunctions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Statistics/BasicFunctions.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BasicFunctions.cs 21 Aug 2005 10:09:23 -0000 1.5 --- BasicFunctions.cs 3 Sep 2005 23:53:17 -0000 1.6 *************** *** 22,26 **** using System; ! using QuantProject.ADT.Statistics; namespace QuantProject.ADT.Statistics --- 22,26 ---- using System; ! using System.Collections; namespace QuantProject.ADT.Statistics *************** *** 50,54 **** } ! static public double Sum( float[] data ) { double sum = 0; --- 50,54 ---- } ! static public double Sum( float[] data ) { double sum = 0; *************** *** 59,63 **** return sum; } ! static public double SumOfSquares( double[] data ) { double sumOfSquares = 0; --- 59,82 ---- return sum; } ! static public double GetSum( ICollection data ) ! { ! double sum = 0; ! foreach( object obj in data ) ! { ! double valueToBeAdded; ! try ! { ! valueToBeAdded = Convert.ToDouble( obj ); ! } ! catch ! { ! throw new Exception( "The data collection contains " + ! "a data that cannot be converted to double!" ); ! } ! sum += valueToBeAdded; ! } ! return sum; ! } ! static public double SumOfSquares( double[] data ) { double sumOfSquares = 0; *************** *** 79,86 **** } ! static public double SimpleAverage( double[] data ) ! { ! return BasicFunctions.Sum(data)/data.Length; ! } static public double SimpleAverage( float[] data ) --- 98,105 ---- } ! static public double SimpleAverage( double[] data ) ! { ! return BasicFunctions.Sum(data)/data.Length; ! } static public double SimpleAverage( float[] data ) *************** *** 88,92 **** return BasicFunctions.Sum(data)/data.Length; } ! static public double Variance( double[] data ) { double sum = BasicFunctions.Sum(data); --- 107,115 ---- return BasicFunctions.Sum(data)/data.Length; } ! static public double GetSimpleAverage( ICollection data ) ! { ! return BasicFunctions.GetSum( data )/data.Count; ! } ! static public double Variance( double[] data ) { double sum = BasicFunctions.Sum(data); *************** *** 101,105 **** } ! static public double CoVariance( double[] firstDataVariable, double[] secondDataVariable ) { --- 124,138 ---- } ! static public double GetVariance( ICollection data ) ! { ! double simpleAverage = BasicFunctions.GetSimpleAverage(data); ! double sum = 0; ! foreach ( object obj in data ) ! sum += ( Convert.ToDouble( obj ) - simpleAverage ) * ! ( Convert.ToDouble( obj ) - simpleAverage ); ! return sum / ( data.Count - 1 ); ! } ! ! static public double CoVariance( double[] firstDataVariable, double[] secondDataVariable ) { *************** *** 131,134 **** --- 164,171 ---- return System.Math.Sqrt(BasicFunctions.Variance(data)); } + static public double GetStdDev( ICollection data ) + { + return System.Math.Sqrt( BasicFunctions.GetVariance( data ) ); + } static public double PearsonCorrelationCoefficient( double[] firstDataVariable, |
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:40:39
|
Update of /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8771/b5_Presentation/Reporting/WindowsForm Modified Files: SummaryTabPage.cs Log Message: Useless code has been removed Index: SummaryTabPage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b5_Presentation/Reporting/WindowsForm/SummaryTabPage.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SummaryTabPage.cs 19 Jun 2005 14:45:43 -0000 1.6 --- SummaryTabPage.cs 3 Sep 2005 23:40:30 -0000 1.7 *************** *** 53,97 **** private SummaryRow summaryRow; - private System.Windows.Forms.Label lblValTotalNetProfit; - private System.Windows.Forms.Label lblTotalNetProfit; - private System.Windows.Forms.Label lblReturnOnAccount; - private System.Windows.Forms.Label lblValReturnOnAccount; - private System.Windows.Forms.Label lblAnnualSystemPercReturn; - private System.Windows.Forms.Label lblValAnnualSystemPercReturn; - private System.Windows.Forms.Label lblMaxEquityDrawDown; - private System.Windows.Forms.Label lblValMaxEquityDrawDown; - private System.Windows.Forms.Label lblTotalCommission; - private System.Windows.Forms.Label lblValTotalCommission; - private System.Windows.Forms.Label lblNumberWinningPeriods; - private System.Windows.Forms.Label lblValNumberWinningPeriods; - private System.Windows.Forms.Label lblNumberLosingPeriods; - private System.Windows.Forms.Label lblValNumberLosingPeriods; - private System.Windows.Forms.Label lblNumberEvenPeriods; - private System.Windows.Forms.Label lblValNumberEvenPeriods; - private System.Windows.Forms.Label lblPercentageWinningPeriods; - private System.Windows.Forms.Label lblValPercentageWinningPeriods; - private System.Windows.Forms.Label lblTotalNumberOfTrades; - private System.Windows.Forms.Label lblValTotalNumberOfTrades; - private System.Windows.Forms.Label lblNumberWinningTrades; - private System.Windows.Forms.Label lblValNumberWinningTrades; - private System.Windows.Forms.Label lblAverageTradePercReturn; - private System.Windows.Forms.Label lblValAverageTradePercReturn; - private System.Windows.Forms.Label lblLargestWinningTrade; - private System.Windows.Forms.Label lblValLargestWinningTrade; - private System.Windows.Forms.Label lblLargestLosingTrade; - private System.Windows.Forms.Label lblValLargestLosingTrade; - private System.Windows.Forms.Label lblTotalNumberOfLongTrades; - private System.Windows.Forms.Label lblValTotalNumberOfLongTrades; - private System.Windows.Forms.Label lblAverageLongTradePercReturn; - private System.Windows.Forms.Label lblValAverageLongTradePercReturn; - private System.Windows.Forms.Label lblNumberWinningShortTrades; - private System.Windows.Forms.Label lblValNumberWinningShortTrades; - private System.Windows.Forms.Label lblBenchmarkPercReturn; - private System.Windows.Forms.Label lblValBenchmarkPercReturn; - private System.Windows.Forms.Label lblNumberWinningLongTrades; - private System.Windows.Forms.Label lblValNumberWinningLongTrades; - private System.Windows.Forms.Label lblTotalNumberOfShortTrades; - private System.Windows.Forms.Label lblValTotalNumberOfShortTrades; - private AccountReport accountReport; --- 53,56 ---- *************** *** 175,398 **** myInitializeComponent_addSummaryRow( summaryProperty ); } - private void myInitializeComponent_old() - { - this.summaryItems = new ArrayList(); - myInitializeComponent_addSummaryRows(); - foreach( SummaryItem summaryItem in this.summaryItems ) - this.myInitializeComponent_addItem( summaryItem ); - - this.lblTotalNetProfit = new System.Windows.Forms.Label(); - this.lblValTotalNetProfit = new System.Windows.Forms.Label(); - this.lblReturnOnAccount = new System.Windows.Forms.Label(); - this.lblValReturnOnAccount = new System.Windows.Forms.Label(); - this.lblBenchmarkPercReturn = new System.Windows.Forms.Label(); - this.lblValBenchmarkPercReturn = new System.Windows.Forms.Label(); - this.lblAnnualSystemPercReturn = new System.Windows.Forms.Label(); - this.lblValAnnualSystemPercReturn = new System.Windows.Forms.Label(); - this.lblMaxEquityDrawDown = new System.Windows.Forms.Label(); - this.lblValMaxEquityDrawDown = new System.Windows.Forms.Label(); - this.lblTotalCommission = new System.Windows.Forms.Label(); - this.lblValTotalCommission = new System.Windows.Forms.Label(); - this.lblNumberWinningPeriods = new System.Windows.Forms.Label(); - this.lblValNumberWinningPeriods = new System.Windows.Forms.Label(); - this.lblNumberLosingPeriods = new System.Windows.Forms.Label(); - this.lblValNumberLosingPeriods = new System.Windows.Forms.Label(); - this.lblNumberEvenPeriods = new System.Windows.Forms.Label(); - this.lblValNumberEvenPeriods = new System.Windows.Forms.Label(); - this.lblPercentageWinningPeriods = new System.Windows.Forms.Label(); - this.lblValPercentageWinningPeriods = new System.Windows.Forms.Label(); - this.lblTotalNumberOfTrades = new System.Windows.Forms.Label(); - this.lblValTotalNumberOfTrades = new System.Windows.Forms.Label(); - this.lblNumberWinningTrades = new System.Windows.Forms.Label(); - this.lblValNumberWinningTrades = new System.Windows.Forms.Label(); - this.lblAverageTradePercReturn = new System.Windows.Forms.Label(); - this.lblValAverageTradePercReturn = new System.Windows.Forms.Label(); - this.lblLargestWinningTrade = new System.Windows.Forms.Label(); - this.lblValLargestWinningTrade = new System.Windows.Forms.Label(); - this.lblLargestLosingTrade = new System.Windows.Forms.Label(); - this.lblValLargestLosingTrade = new System.Windows.Forms.Label(); - this.lblTotalNumberOfLongTrades = new System.Windows.Forms.Label(); - this.lblValTotalNumberOfLongTrades = new System.Windows.Forms.Label(); - this.lblNumberWinningLongTrades = new System.Windows.Forms.Label(); - this.lblValNumberWinningLongTrades = new System.Windows.Forms.Label(); - this.lblAverageLongTradePercReturn = new System.Windows.Forms.Label(); - this.lblValAverageLongTradePercReturn = new System.Windows.Forms.Label(); - this.lblTotalNumberOfShortTrades = new System.Windows.Forms.Label(); - this.lblValTotalNumberOfShortTrades = new System.Windows.Forms.Label(); - this.lblNumberWinningShortTrades = new System.Windows.Forms.Label(); - this.lblValNumberWinningShortTrades = new System.Windows.Forms.Label(); - // - // lblTotalNetProfit - // - this.addTextLabel( lblTotalNetProfit , "lblTotalNetProfit" , - "Total net profit:" ); - // - // lblValTotalNetProfit - // - this.addValueLabel( lblValTotalNetProfit , "lblValTotalNetProfit" ); - // - // lblReturnOnAccount - // - this.addTextLabel( lblReturnOnAccount , "lblReturnOnAccount" , - "Return on account (%):" ); - // - // lblValReturnOnAccount - // - this.addValueLabel( lblValReturnOnAccount , "lblValReturnOnAccount" ); - // - // lblBenchmarkPercReturn - // - this.addTextLabel( lblBenchmarkPercReturn , "lblBenchmarkPercReturn" , - "Benchmark % return:" ); - // - // lblValBenchmarkPercReturn - // - this.addValueLabel( lblValBenchmarkPercReturn , "lblValBuyAndHoldPercReturn" ); - // - // lblAnnualSystemPercReturn - // - this.addTextLabel( lblAnnualSystemPercReturn , "lblAnnualSystemPercReturn" , - "Annual system % return:" ); - // - // lblValAnnualSystemPercReturn - // - this.addValueLabel( lblValAnnualSystemPercReturn , "lblValAnnualSystemPercReturn" ); - // - // lblMaxEquityDrawDown - // - this.addTextLabel( lblMaxEquityDrawDown , "lblMaxEquityDrawDown" , - "Max equity drawdown (%):" ); - // - // lblValMaxEquityDrawDown - // - this.addValueLabel( lblValMaxEquityDrawDown , "lblValMaxEquityDrawDown" ); - // - // lblTotalCommission - // - this.addTextLabel( this.lblTotalCommission , "lblTotalCommission" , - "Total Commission Amount:" ); - // - // lblValTotalCommission - // - this.addValueLabel( this.lblValTotalCommission , "lblValTotalCommission" ); - // - // lblNumberWinningPeriods - // - this.addTextLabel( this.lblNumberWinningPeriods , "lblNumberWinningPeriods" , - "Number Winning Periods:" ); - // - // lblValNumberWinningPeriods - // - this.addValueLabel( this.lblValNumberWinningPeriods , "lblValNumberWinningPeriods" ); - // - // lblNumberLosingPeriods - // - this.addTextLabel( this.lblNumberLosingPeriods , "lblNumberWinningPeriods" , - "Number Losing Periods:" ); - // - // lblValNumberLosingPeriods - // - this.addValueLabel( this.lblValNumberLosingPeriods , "lblValNumberLosingPeriods" ); - // - // lblPercentageWinningPeriods - // - this.addTextLabel( this.lblPercentageWinningPeriods , "lblPercentageWinningPeriods" , - "% Winning Periods:" ); - // - // lblValPercentageWinningPeriods - // - this.addValueLabel( this.lblValPercentageWinningPeriods , "lblValPercentageWinningPeriods" ); - // - // lblTotalNumberOfTrades - // - this.addTextLabel( lblTotalNumberOfTrades , "lblTotalNumberOfTrades" , - "Total # of trades:" ); - // - // lblValTotalNumberOfTrades - // - this.addValueLabel( lblValTotalNumberOfTrades , "lblValTotalNumberOfTrades" ); - // - // lblNumberWinningTrades - // - this.addTextLabel( lblNumberWinningTrades , "lblNumberWinningTrades" , - "Number winning trades:" ); - // - // lblValNumberWinningTrades - // - this.addValueLabel( lblValNumberWinningTrades , "lblValNumberWinningTrades" ); - // - // lblAverageTradePercReturn - // - this.addTextLabel( this.lblAverageTradePercReturn , "lblAverageTradePercReturn" , - "Average trade % return:" ); - // - // lblValAverageTradePercReturn - // - this.addValueLabel( lblValAverageTradePercReturn , "lblValAverageTradePercReturn" ); - // - // lblLargestWinningTrade - // - this.addTextLabel( lblLargestWinningTrade , "lblNumberWinningTrades" , - "Largest winning trade (%):" ); - // - // lblValLargestWinningTrade - // - this.addValueLabel( lblValLargestWinningTrade , "lblValLargestWinningTrade" ); - // - // lblLargestLosingTrade - // - this.addTextLabel( lblLargestLosingTrade , "lblNumberWinningTrades" , - "Largest losing trade:" ); - // - // lblValLargestLosingTrade - // - this.addValueLabel( lblValLargestLosingTrade , "lblValLargestLosingTrade" ); - // - // lblTotalNumberOfLongTrades - // - this.addTextLabel( lblTotalNumberOfLongTrades , "lblTotalNumberOfLongTrades" , - "Total # of long trades:" ); - // - // lblValTotalNumberOfLongTrades - // - this.addValueLabel( lblValTotalNumberOfLongTrades , "lblValTotalNumberOfLongTrades" ); - // - // lblNumberWinningLongTrades - // - this.addTextLabel( lblNumberWinningLongTrades , "lblNumberWinningLongTrades" , - "Number winning long trades:" ); - // - // lblValNumberWinningLongTrades - // - this.addValueLabel( lblValNumberWinningLongTrades , "lblValNumberWinningLongTrades" ); - // - // lblAverageLongTradePercReturn - // - this.addTextLabel( lblAverageLongTradePercReturn , "lblAverageLongTradePercReturn" , - "Average long trade % return:" ); - // - // lblValAverageLongTradePercReturn - // - this.addValueLabel( lblValAverageLongTradePercReturn , "lblValAverageLongTradePercReturn" ); - // - // lblTotalNumberOfShortTrades - // - this.addTextLabel( lblTotalNumberOfShortTrades , "lblTotalNumberOfShortTrades" , - "Total numbero of short trades:" ); - // - // lblValTotalNumberOfShortTrades - // - this.addValueLabel( lblValTotalNumberOfShortTrades , "lblValTotalNumberOfShortTrades" ); - // - // lblNumberWinningShortTrades - // - this.addTextLabel( lblNumberWinningShortTrades , "lblNumberWinningShortTrades" , - "Number winning short trades:" ); - // - // lblValNumberWinningShortTrades - // - this.addValueLabel( lblValNumberWinningShortTrades , "lblValNumberWinningShortTrades" ); - } - private void myInitializeComponent() { --- 134,137 ---- *************** *** 403,447 **** } - private void setSummaryValues() - { - this.lblValTotalNetProfit.Text = - FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.TotalPnl ); - this.lblValReturnOnAccount.Text = - FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.ReturnOnAccount.Value ); - this.lblValBenchmarkPercReturn.Text = - FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.BenchmarkPercentageReturn.Value ); - this.lblValAnnualSystemPercReturn.Text = - FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.AnnualSystemPercentageReturn.Value ); - // this.lblValMaxEquityDrawDown.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.MaxEquityDrawDown ); - this.lblValTotalCommission.Text = - FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.TotalCommissionAmount.Value ); - this.lblValNumberWinningPeriods.Text = - this.accountReport.Summary.NumberWinningPeriods.ToString(); - this.lblValNumberLosingPeriods.Text = - this.accountReport.Summary.NumberLosingPeriods.ToString(); - this.lblValPercentageWinningPeriods.Text = - FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.PercentageWinningPeriods.Value ); - // this.lblValTotalNumberOfTrades.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.TotalNumberOfTrades ); - // this.lblValNumberWinningTrades.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.NumberWinningTrades ); - // this.lblValAverageTradePercReturn.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( this.accountReport.Summary.AverageTradePercentageReturn ); - // this.lblValLargestWinningTrade.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.LargestWinningTradePercentage.Value ); - // this.lblValLargestLosingTrade.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.LargestLosingTradePercentage.Value ); - // this.lblValTotalNumberOfLongTrades.Text = - // FormatProvider.ConvertToStringWithZeroDecimals( (int)this.accountReport.Summary.TotalNumberOfLongTrades.Value ); - // this.lblValNumberWinningLongTrades.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.NumberWinningLongTrades.Value ); - // this.lblValAverageLongTradePercReturn.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.AverageLongTradePercentageReturn.Value ); - // this.lblValTotalNumberOfShortTrades.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.TotalNumberOfShortTrades.Value ); - // this.lblValNumberWinningShortTrades.Text = - // FormatProvider.ConvertToStringWithTwoDecimals( (double)this.accountReport.Summary.NumberWinningShortTrades.Value ); - } public SummaryTabPage( AccountReport accountReport ) { --- 142,145 ---- |
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:23:40
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6791/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Modified Files: Summary.cs Log Message: - SharpeRatio has been introduced - old, useless code has been commented out Index: Summary.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Summary.cs 19 Jun 2005 14:46:59 -0000 1.16 --- Summary.cs 3 Sep 2005 23:23:32 -0000 1.17 *************** *** 25,28 **** --- 25,29 ---- private ReturnOnAccount returnOnAccount; private MaxEquityDrawDown maxEquityDrawDown; + private SharpeRatio sharpeRatio; private TotalNumberOfTrades totalNumberOfTrades; private NumberWinningTrades numberWinningTrades; *************** *** 75,78 **** --- 76,83 ---- get { return this.maxEquityDrawDown; } } + public SharpeRatio SharpeRatio + { + get { return this.sharpeRatio; } + } public TotalCommissionAmount TotalCommissionAmount { *************** *** 164,248 **** } #region "getSummaryTable_setRows" ! private void getSummary_setRow( SummaryRow summaryRow , DataTable summaryDataTable ) ! { ! if ( summaryRow.Value != null ) ! { ! DataRow summary = summaryDataTable.NewRow(); ! summary[ "Information" ] = summaryRow.Description; ! summary[ "Value" ] = summaryRow.Value; ! summaryDataTable.Rows.Add( summary ); ! } ! } ! private void getSummaryTable_setRows( DataTable summaryDataTable ) { ! getSummary_setRow( new TotalNetProfit( this ) , summaryDataTable ); this.returnOnAccount = new ReturnOnAccount( this ); - getSummary_setRow( this.returnOnAccount , summaryDataTable ); this.benchmarkPercentageReturn = new BenchmarkPercentageReturn( this , this.historicalQuoteProvider ); - getSummary_setRow( this.benchmarkPercentageReturn , - summaryDataTable ); this.numberWinningPeriods = new NumberWinningPeriods( this ); - getSummary_setRow( this.numberWinningPeriods , summaryDataTable ); this.numberLosingPeriods = new NumberLosingPeriods( this ); - getSummary_setRow( this.numberLosingPeriods , summaryDataTable ); - getSummary_setRow( new NumberEvenPeriods( this ) , summaryDataTable ); this.percentageWinningPeriods = new PercentageWinningPeriods( this ); - getSummary_setRow( this.percentageWinningPeriods , summaryDataTable ); - //this.getSummary_setRows_forEquityVsBenchmarkComparison(); this.totalNetProfit = new TotalNetProfit( this ); this.annualSystemPercentageReturn = new AnnualSystemPercentageReturn( this ); - getSummary_setRow( this.annualSystemPercentageReturn , summaryDataTable ); this.maxEquityDrawDown = new MaxEquityDrawDown( this ); ! getSummary_setRow( this.maxEquityDrawDown , summaryDataTable ); this.totalNumberOfTrades = new TotalNumberOfTrades( this ); - getSummary_setRow( this.totalNumberOfTrades , summaryDataTable ); this.numberWinningTrades = new NumberWinningTrades( this ); - getSummary_setRow( this.numberWinningTrades , summaryDataTable ); this.averageTradePercentageReturn = new AverageTradePercentageReturn( this ); - getSummary_setRow( this.averageTradePercentageReturn , summaryDataTable ); this.largestWinningTradePercentage = new LargestWinningTradePercentage( this ); - getSummary_setRow( this.largestWinningTradePercentage , summaryDataTable ); this.largestLosingTradePercentage = new LargestLosingTradePercentage( this ); - getSummary_setRow( this.largestLosingTradePercentage , summaryDataTable ); this.totalNumberOfLongTrades = new TotalNumberOfLongTrades( this ); - getSummary_setRow( this.totalNumberOfLongTrades , summaryDataTable ); this.numberWinningLongTrades = new NumberWinningLongTrades( this ); - getSummary_setRow( this.numberWinningLongTrades , summaryDataTable ); this.averageLongTradePercentageReturn = new AverageLongTradePercentageReturn( this ); - getSummary_setRow( this.averageLongTradePercentageReturn , summaryDataTable ); this.totalNumberOfShortTrades = new TotalNumberOfShortTrades( this ); - getSummary_setRow( this.totalNumberOfShortTrades , summaryDataTable ); this.numberWinningShortTrades = new NumberWinningShortTrades( this ); - getSummary_setRow( this.numberWinningShortTrades , summaryDataTable ); this.totalCommissionAmount = new TotalCommissionAmount( this ); ! getSummary_setRow( this.totalCommissionAmount , summaryDataTable ); ! // getSummary_setRow( summaryDataTable , ! // new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) ); ! // getSummary_setRow( summaryDataTable , ! // new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningShortTrades ) ); ! // getSummary_setRow( summaryDataTable , ! // new getSummaryTable_setRow( getSummaryTable_setRow_AverageShortTradePercentageReturn ) ); ! } ! #endregion ! private DataTable getSummaryDataTable() ! { ! DataTable summaryDataTable = new DataTable(); ! getSummaryTable_setColumns( summaryDataTable ); ! getSummaryTable_setRows( summaryDataTable ); ! return summaryDataTable; ! } ! private void getSummary() ! { ! if ( this.accountReport.Equity.DataTable.Rows.Count == 0 ) ! throw new Exception( "A Summary computation has been requested, but the equity line is empty" ); ! this.totalPnl = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "PnL" ]; ! this.finalAccountValue = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "AccountValue" ]; ! this.intervalDays = ! ((TimeSpan)((DateTime)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "Date" ] - ! (DateTime)this.accountReport.Equity.DataTable.Rows[ 0 ][ "Date" ])).Days; ! this.DataTable = getSummaryDataTable(); } --- 169,274 ---- } #region "getSummaryTable_setRows" ! // private void getSummary_setRow( SummaryRow summaryRow , DataTable summaryDataTable ) ! // { ! // if ( summaryRow.Value != null ) ! // { ! // DataRow summary = summaryDataTable.NewRow(); ! // summary[ "Information" ] = summaryRow.Description; ! // summary[ "Value" ] = summaryRow.Value; ! // summaryDataTable.Rows.Add( summary ); ! // } ! // } ! // private void getSummaryTable_setRows( DataTable summaryDataTable ) ! // { ! //// getSummary_setRow( new TotalNetProfit( this ) , summaryDataTable ); ! // this.returnOnAccount = new ReturnOnAccount( this ); ! //// getSummary_setRow( this.returnOnAccount , summaryDataTable ); ! // this.benchmarkPercentageReturn = ! // new BenchmarkPercentageReturn( this , this.historicalQuoteProvider ); ! //// getSummary_setRow( this.benchmarkPercentageReturn , ! //// summaryDataTable ); ! // this.numberWinningPeriods = new NumberWinningPeriods( this ); ! //// getSummary_setRow( this.numberWinningPeriods , summaryDataTable ); ! // this.numberLosingPeriods = new NumberLosingPeriods( this ); ! //// getSummary_setRow( this.numberLosingPeriods , summaryDataTable ); ! //// getSummary_setRow( new NumberEvenPeriods( this ) , summaryDataTable ); ! // this.percentageWinningPeriods = new PercentageWinningPeriods( this ); ! //// getSummary_setRow( this.percentageWinningPeriods , summaryDataTable ); ! // //this.getSummary_setRows_forEquityVsBenchmarkComparison(); ! // this.totalNetProfit = new TotalNetProfit( this ); ! // this.annualSystemPercentageReturn = new AnnualSystemPercentageReturn( this ); ! //// getSummary_setRow( this.annualSystemPercentageReturn , summaryDataTable ); ! // this.maxEquityDrawDown = new MaxEquityDrawDown( this ); ! // // getSummary_setRow( this.maxEquityDrawDown , summaryDataTable ); ! // this.totalNumberOfTrades = new TotalNumberOfTrades( this ); ! //// getSummary_setRow( this.totalNumberOfTrades , summaryDataTable ); ! // this.numberWinningTrades = new NumberWinningTrades( this ); ! //// getSummary_setRow( this.numberWinningTrades , summaryDataTable ); ! // this.averageTradePercentageReturn = new AverageTradePercentageReturn( this ); ! //// getSummary_setRow( this.averageTradePercentageReturn , summaryDataTable ); ! // this.largestWinningTradePercentage = new LargestWinningTradePercentage( this ); ! //// getSummary_setRow( this.largestWinningTradePercentage , summaryDataTable ); ! // this.largestLosingTradePercentage = new LargestLosingTradePercentage( this ); ! //// getSummary_setRow( this.largestLosingTradePercentage , summaryDataTable ); ! // this.totalNumberOfLongTrades = new TotalNumberOfLongTrades( this ); ! //// getSummary_setRow( this.totalNumberOfLongTrades , summaryDataTable ); ! // this.numberWinningLongTrades = new NumberWinningLongTrades( this ); ! //// getSummary_setRow( this.numberWinningLongTrades , summaryDataTable ); ! // this.averageLongTradePercentageReturn = new AverageLongTradePercentageReturn( this ); ! //// getSummary_setRow( this.averageLongTradePercentageReturn , summaryDataTable ); ! // this.totalNumberOfShortTrades = new TotalNumberOfShortTrades( this ); ! //// getSummary_setRow( this.totalNumberOfShortTrades , summaryDataTable ); ! // this.numberWinningShortTrades = new NumberWinningShortTrades( this ); ! //// getSummary_setRow( this.numberWinningShortTrades , summaryDataTable ); ! // this.totalCommissionAmount = new TotalCommissionAmount( this ); ! //// getSummary_setRow( this.totalCommissionAmount , summaryDataTable ); ! // // getSummary_setRow( summaryDataTable , ! //// new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) ); ! //// getSummary_setRow( summaryDataTable , ! //// new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningShortTrades ) ); ! //// getSummary_setRow( summaryDataTable , ! //// new getSummaryTable_setRow( getSummaryTable_setRow_AverageShortTradePercentageReturn ) ); ! // } ! #endregion ! // private DataTable getSummaryDataTable() ! // { ! // DataTable summaryDataTable = new DataTable(); ! // getSummaryTable_setColumns( summaryDataTable ); ! // getSummaryTable_setRows( summaryDataTable ); ! // return summaryDataTable; ! // } ! private void getSummary() { ! if ( this.accountReport.Equity.DataTable.Rows.Count == 0 ) ! throw new Exception( "A Summary computation has been requested, but the equity line is empty" ); ! this.totalPnl = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "PnL" ]; ! this.finalAccountValue = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "AccountValue" ]; ! this.intervalDays = ! ((TimeSpan)((DateTime)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "Date" ] - ! (DateTime)this.accountReport.Equity.DataTable.Rows[ 0 ][ "Date" ])).Days; this.returnOnAccount = new ReturnOnAccount( this ); this.benchmarkPercentageReturn = new BenchmarkPercentageReturn( this , this.historicalQuoteProvider ); this.numberWinningPeriods = new NumberWinningPeriods( this ); this.numberLosingPeriods = new NumberLosingPeriods( this ); this.percentageWinningPeriods = new PercentageWinningPeriods( this ); this.totalNetProfit = new TotalNetProfit( this ); this.annualSystemPercentageReturn = new AnnualSystemPercentageReturn( this ); this.maxEquityDrawDown = new MaxEquityDrawDown( this ); ! this.sharpeRatio = new SharpeRatio( this.accountReport.EquityHistory ); this.totalNumberOfTrades = new TotalNumberOfTrades( this ); this.numberWinningTrades = new NumberWinningTrades( this ); this.averageTradePercentageReturn = new AverageTradePercentageReturn( this ); this.largestWinningTradePercentage = new LargestWinningTradePercentage( this ); this.largestLosingTradePercentage = new LargestLosingTradePercentage( this ); this.totalNumberOfLongTrades = new TotalNumberOfLongTrades( this ); this.numberWinningLongTrades = new NumberWinningLongTrades( this ); this.averageLongTradePercentageReturn = new AverageLongTradePercentageReturn( this ); this.totalNumberOfShortTrades = new TotalNumberOfShortTrades( this ); this.numberWinningShortTrades = new NumberWinningShortTrades( this ); this.totalCommissionAmount = new TotalCommissionAmount( this ); ! // this.DataTable = getSummaryDataTable(); } |
|
From: Glauco S. <gl...@my...> - 2005-08-29 13:53:40
|
At 09:54 AM 8/29/2005 +0200, you wrote: >Piccola osservazione: io ho cannato (osservo che pestare un bel merdone=20 >dovrebbe portare fortuna ...), ma =E8 sbagliato anche che una "costante"=20 >venga rappresentata da una "variabile" ... Assolutamente... Ma mi sa che abbiamo fatto cosi' perche' con le costanti=20 non si puo' sfruttare l'intellisense. Almeno credo... |