quantproject-developers Mailing List for QuantProject (Page 30)
Brought to you by:
glauco_1
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(103) |
Dec
(67) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(52) |
Feb
(9) |
Mar
(69) |
Apr
(53) |
May
(80) |
Jun
(23) |
Jul
(24) |
Aug
(112) |
Sep
(9) |
Oct
|
Nov
(58) |
Dec
(93) |
| 2005 |
Jan
(90) |
Feb
(93) |
Mar
(61) |
Apr
(56) |
May
(37) |
Jun
(61) |
Jul
(55) |
Aug
(68) |
Sep
(25) |
Oct
(46) |
Nov
(41) |
Dec
(37) |
| 2006 |
Jan
(33) |
Feb
(7) |
Mar
(19) |
Apr
(27) |
May
(73) |
Jun
(49) |
Jul
(83) |
Aug
(66) |
Sep
(45) |
Oct
(16) |
Nov
(15) |
Dec
(7) |
| 2007 |
Jan
(14) |
Feb
(33) |
Mar
|
Apr
(21) |
May
|
Jun
(34) |
Jul
(18) |
Aug
(100) |
Sep
(39) |
Oct
(55) |
Nov
(12) |
Dec
(2) |
| 2008 |
Jan
(120) |
Feb
(133) |
Mar
(129) |
Apr
(104) |
May
(42) |
Jun
(2) |
Jul
(52) |
Aug
(99) |
Sep
(134) |
Oct
|
Nov
(137) |
Dec
(48) |
| 2009 |
Jan
(48) |
Feb
(55) |
Mar
(61) |
Apr
(3) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(51) |
Sep
|
Oct
(7) |
Nov
|
Dec
|
| 2010 |
Jan
(7) |
Feb
(1) |
Mar
(145) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
|
| 2011 |
Jan
(78) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(88) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2013 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:43:36
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/Logging In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13996/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/Logging Modified Files: TesterForFLTPTestingPositions.cs Log Message: A new parameter of type Timer has been added to the EndOfDayStrategyBackTester Index: TesterForFLTPTestingPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/Logging/TesterForFLTPTestingPositions.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TesterForFLTPTestingPositions.cs 29 Sep 2008 21:20:14 -0000 1.2 --- TesterForFLTPTestingPositions.cs 12 Nov 2008 20:43:30 -0000 1.3 *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 102,106 **** FLTPSimpleStrategy fLTPSimpleStrategy = new FLTPSimpleStrategy( weightedPositions , ! intervalsSelector , HistoricalMarketValueProvider ); IAccountProvider accountProvider = new SimpleAccountProvider(); --- 102,106 ---- FLTPSimpleStrategy fLTPSimpleStrategy = new FLTPSimpleStrategy( weightedPositions , ! intervalsSelector , HistoricalMarketValueProvider ); IAccountProvider accountProvider = new SimpleAccountProvider(); *************** *** 108,112 **** DateTime firstDateTime = this.dateTimeWhenThisObjectWasLogged.AddDays( ! - this.numberOfInSampleDays ); DateTime lastDateTime = this.dateTimeWhenThisObjectWasLogged; --- 108,112 ---- DateTime firstDateTime = this.dateTimeWhenThisObjectWasLogged.AddDays( ! - this.numberOfInSampleDays ); DateTime lastDateTime = this.dateTimeWhenThisObjectWasLogged; *************** *** 114,121 **** EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "SimpleFLTP" , fLTPSimpleStrategy , ! HistoricalMarketValueProvider , accountProvider , ! firstDateTime , lastDateTime , ! benchmark , cashToStart , maxRunningHours ); // simpleStrategy.Account = endOfDayStrategyBackTester.Account; --- 114,125 ---- EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "SimpleFLTP" , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! benchmark.Ticker ) , ! fLTPSimpleStrategy , ! HistoricalMarketValueProvider , accountProvider , ! firstDateTime , lastDateTime , ! benchmark , cashToStart , maxRunningHours ); // simpleStrategy.Account = endOfDayStrategyBackTester.Account; *************** *** 136,140 **** // WeightedPosition weightedPosition ) // { ! //// double[] weights = { 1 }; // double[] weights = { this.getWeightedPositions_getWeight( weightedPosition ) }; // string[] tickers = { weightedPosition.Ticker }; --- 140,144 ---- // WeightedPosition weightedPosition ) // { ! //// double[] weights = { 1 }; // double[] weights = { this.getWeightedPositions_getWeight( weightedPosition ) }; // string[] tickers = { weightedPosition.Ticker }; *************** *** 168,176 **** WeightedPositions weightedPositions = this.testingPositions.WeightedPositions; ! AccountReport accountReport = this.getAccountReport( weightedPositions , intervalsSelector , ! historicalMarketValueProvider , ! benchmark , 30000 ); Report report = --- 172,180 ---- WeightedPositions weightedPositions = this.testingPositions.WeightedPositions; ! AccountReport accountReport = this.getAccountReport( weightedPositions , intervalsSelector , ! historicalMarketValueProvider , ! benchmark , 30000 ); Report report = *************** *** 180,184 **** // accountReportForFirstPosition.EquityLine.LastDateTime , // EndOfDaySpecificTime.OneHourAfterMarketClose ); ! // report.Create( "PearsonDebug" , 1 , // lastEndOfDayDateTimeForReport , --- 184,188 ---- // accountReportForFirstPosition.EquityLine.LastDateTime , // EndOfDaySpecificTime.OneHourAfterMarketClose ); ! // report.Create( "PearsonDebug" , 1 , // lastEndOfDayDateTimeForReport , |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:43:20
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13958/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases Modified Files: FixedLengthTwoPhasesMain.cs Log Message: A new parameter of type Timer has been added to the EndOfDayStrategyBackTester Index: FixedLengthTwoPhasesMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/FixedLengthTwoPhases/FixedLengthTwoPhasesMain.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FixedLengthTwoPhasesMain.cs 29 Sep 2008 21:19:08 -0000 1.11 --- FixedLengthTwoPhasesMain.cs 12 Nov 2008 20:43:09 -0000 1.12 *************** *** 111,115 **** int numberOfBestTestingPositionsToBeReturned = 20; // uncomment the following line for a faster script ! numberOfBestTestingPositionsToBeReturned = 5; IDecoderForTestingPositions decoderForWeightedPositions = --- 111,115 ---- int numberOfBestTestingPositionsToBeReturned = 20; // uncomment the following line for a faster script ! numberOfBestTestingPositionsToBeReturned = 5; IDecoderForTestingPositions decoderForWeightedPositions = *************** *** 212,216 **** EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , this.strategyForBacktester , this.historicalMarketValueProviderForTheBacktesterAccount , accountProvider , --- 212,220 ---- EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! this.benchmark.Ticker ) , ! this.strategyForBacktester , this.historicalMarketValueProviderForTheBacktesterAccount , accountProvider , |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:42:42
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13897/b4_Business/a2_Strategies Modified Files: EndOfDayStrategyBackTester.cs Log Message: A new parameter of type Timer has been added to the EndOfDayStrategyBackTester Index: EndOfDayStrategyBackTester.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategyBackTester.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EndOfDayStrategyBackTester.cs 29 Sep 2008 21:16:18 -0000 1.10 --- EndOfDayStrategyBackTester.cs 12 Nov 2008 20:42:39 -0000 1.11 *************** *** 160,163 **** --- 160,164 ---- public EndOfDayStrategyBackTester( string backTestID , + Timer timer , IStrategyForBacktester strategyForBacktester , HistoricalMarketValueProvider historicalMarketValueProvider , *************** *** 185,188 **** --- 186,191 ---- this.cashToStart = cashToStart; this.maxRunningHours = maxRunningHours; + + this.timer = timer; this.initialize_endOfDayTimer(); |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:42:42
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13897/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVO_CTOLogItem.cs PVO_CTOMain.cs PVO_OTCLogItem.cs PVO_OTCMain.cs PVOLogItem.cs PVOMain.cs Log Message: A new parameter of type Timer has been added to the EndOfDayStrategyBackTester Index: PVO_OTCLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_OTCLogItem.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PVO_OTCLogItem.cs 29 Sep 2008 21:17:48 -0000 1.5 --- PVO_OTCLogItem.cs 12 Nov 2008 20:42:39 -0000 1.6 *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 39,52 **** namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator { ! /// <summary> ! /// LogItem for the PVO_OTC strategy ! /// portfolio value oscillator strategy ! /// </summary> ! [Serializable] ! public class PVO_OTCLogItem : PVOLogItem ! { public PVO_OTCLogItem(DateTime dateTime, ! int numberOfInSampleDays) : base( dateTime , numberOfInSampleDays ) { --- 39,52 ---- namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator { ! /// <summary> ! /// LogItem for the PVO_OTC strategy ! /// portfolio value oscillator strategy ! /// </summary> ! [Serializable] ! public class PVO_OTCLogItem : PVOLogItem ! { public PVO_OTCLogItem(DateTime dateTime, ! int numberOfInSampleDays) : base( dateTime , numberOfInSampleDays ) { *************** *** 70,80 **** HistoricalMarketValueProvider historicalQuoteProviderForBackTester, ! historicalQuoteProviderForInSampleChooser, ! historicalQuoteProviderForStrategy; historicalQuoteProviderForBackTester = new HistoricalAdjustedQuoteProvider(); historicalQuoteProviderForInSampleChooser = historicalQuoteProviderForBackTester; historicalQuoteProviderForStrategy = historicalQuoteProviderForInSampleChooser; ! IEligiblesSelector eligiblesSelector = new DummyEligibleSelector(); --- 70,80 ---- HistoricalMarketValueProvider historicalQuoteProviderForBackTester, ! historicalQuoteProviderForInSampleChooser, ! historicalQuoteProviderForStrategy; historicalQuoteProviderForBackTester = new HistoricalAdjustedQuoteProvider(); historicalQuoteProviderForInSampleChooser = historicalQuoteProviderForBackTester; historicalQuoteProviderForStrategy = historicalQuoteProviderForInSampleChooser; ! IEligiblesSelector eligiblesSelector = new DummyEligibleSelector(); *************** *** 85,103 **** PVO_OTCStrategy strategy = new PVO_OTCStrategy(eligiblesSelector, 1, ! positionsToTest, inSampleDays, ! benchmark , ! int.MaxValue , ! 0 , ! ((PVOPositions)positionsToTest[0]).OversoldThreshold, ! ((PVOPositions)positionsToTest[0]).OverboughtThreshold, ! historicalQuoteProviderForStrategy); EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "PVO_OTC" , strategy , ! historicalQuoteProviderForBackTester , ! new SimpleAccountProvider(), ! firstDateTime , ! lastDateTime , benchmark , cashToStart , maxRunningHours ); // TO DO check if you can do this assign in the EndOfDayStrategyBackTester --- 85,107 ---- PVO_OTCStrategy strategy = new PVO_OTCStrategy(eligiblesSelector, 1, ! positionsToTest, inSampleDays, ! benchmark , ! int.MaxValue , ! 0 , ! ((PVOPositions)positionsToTest[0]).OversoldThreshold, ! ((PVOPositions)positionsToTest[0]).OverboughtThreshold, ! historicalQuoteProviderForStrategy); EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "PVO_OTC" , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! benchmark.Ticker ) , ! strategy , ! historicalQuoteProviderForBackTester , ! new SimpleAccountProvider(), ! firstDateTime , ! lastDateTime , benchmark , cashToStart , maxRunningHours ); // TO DO check if you can do this assign in the EndOfDayStrategyBackTester *************** *** 106,110 **** endOfDayStrategyBackTester.Run(); BackTesterReportViewer.ShowReport( lastDateTime , ! endOfDayStrategyBackTester ); } } --- 110,114 ---- endOfDayStrategyBackTester.Run(); BackTesterReportViewer.ShowReport( lastDateTime , ! endOfDayStrategyBackTester ); } } Index: PVO_OTCMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_OTCMain.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PVO_OTCMain.cs 29 Sep 2008 21:17:48 -0000 1.8 --- PVO_OTCMain.cs 12 Nov 2008 20:42:39 -0000 1.9 *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 76,80 **** int maxNumberOfEligiblesToBeChosen = 100; ! string tickersGroupId = "SP500"; --- 76,80 ---- int maxNumberOfEligiblesToBeChosen = 100; ! string tickersGroupId = "SP500"; *************** *** 88,97 **** IEligiblesSelector eligiblesSelector = new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( ! tickersGroupId , temporizedGroup , ! maxNumberOfEligiblesToBeChosen , ! maxNumberOfMostLiquidTickersToBeChosen , ! numDaysForAverageRawOpenPriceComputation , ! numDaysForVolatility , ! minPrice , maxPrice ); // IEligiblesSelector eligiblesSelector = // new ByPriceMostLiquidAlwaysQuoted( --- 88,97 ---- IEligiblesSelector eligiblesSelector = new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( ! tickersGroupId , temporizedGroup , ! maxNumberOfEligiblesToBeChosen , ! maxNumberOfMostLiquidTickersToBeChosen , ! numDaysForAverageRawOpenPriceComputation , ! numDaysForVolatility , ! minPrice , maxPrice ); // IEligiblesSelector eligiblesSelector = // new ByPriceMostLiquidAlwaysQuoted( *************** *** 106,112 **** // numDaysForAverageRawOpenPriceComputation , // minPrice , maxPrice ); ! // eligiblesSelector = // new DummyEligibleSelector(); ! // return eligiblesSelector; } --- 106,112 ---- // numDaysForAverageRawOpenPriceComputation , // minPrice , maxPrice ); ! // eligiblesSelector = // new DummyEligibleSelector(); ! // return eligiblesSelector; } *************** *** 134,145 **** //correlation is computed only for returns //between minimum and maximum ! // IInSampleChooser inSampleChooser = ! // new PVO_OTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, // maxCorrelationAllowed , balancedWeightsOnVolatilityBase, // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); ! IInSampleChooser inSampleChooser = ! new PVO_OTCCTOCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! maxCorrelationAllowed , balancedWeightsOnVolatilityBase, ! minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); // //office // inSampleChooser = --- 134,145 ---- //correlation is computed only for returns //between minimum and maximum ! // IInSampleChooser inSampleChooser = ! // new PVO_OTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, // maxCorrelationAllowed , balancedWeightsOnVolatilityBase, // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); ! IInSampleChooser inSampleChooser = ! new PVO_OTCCTOCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! maxCorrelationAllowed , balancedWeightsOnVolatilityBase, ! minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); // //office // inSampleChooser = *************** *** 171,180 **** // inSampleDays , benchmark , numDaysBetweenEachOptimization , // oversoldThreshold , overboughtThreshold , historicalQuoteProvider); ! // = new PVO_OTCStrategy(eligiblesSelector , ! minNumOfEligiblesForValidOptimization, inSampleChooser , ! inSampleDays , benchmark , numDaysBetweenEachOptimization , ! numOfClosingsBeforeExit, oversoldThreshold , overboughtThreshold , ! oversoldThresholdMAX , overboughtThresholdMAX , historicalQuoteProvider); return strategyForBacktester; } --- 171,180 ---- // inSampleDays , benchmark , numDaysBetweenEachOptimization , // oversoldThreshold , overboughtThreshold , historicalQuoteProvider); ! // = new PVO_OTCStrategy(eligiblesSelector , ! minNumOfEligiblesForValidOptimization, inSampleChooser , ! inSampleDays , benchmark , numDaysBetweenEachOptimization , ! numOfClosingsBeforeExit, oversoldThreshold , overboughtThreshold , ! oversoldThresholdMAX , overboughtThresholdMAX , historicalQuoteProvider); return strategyForBacktester; } *************** *** 198,205 **** EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , this.strategyForBacktester , ! quoteProviderForBackTester , accountProvider , ! firstDateTime , lastDateTime , ! this.benchmark , cashToStart , maxRunningHours ); return endOfDayStrategyBackTester; } --- 198,209 ---- EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! this.benchmark.Ticker ) , ! this.strategyForBacktester , ! quoteProviderForBackTester , accountProvider , ! firstDateTime , lastDateTime , ! this.benchmark , cashToStart , maxRunningHours ); return endOfDayStrategyBackTester; } *************** *** 220,229 **** { string returnValue; ! string fullPathFileNameForMainAtHome = @"C:\Quant\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs"; if( File.Exists(fullPathFileNameForMainAtHome) ) returnValue = fullPathFileNameForMainAtHome; else ! returnValue = @"C:\Utente\MarcoVarie\Vari\qP\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs"; --- 224,233 ---- { string returnValue; ! string fullPathFileNameForMainAtHome = @"C:\Quant\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs"; if( File.Exists(fullPathFileNameForMainAtHome) ) returnValue = fullPathFileNameForMainAtHome; else ! returnValue = @"C:\Utente\MarcoVarie\Vari\qP\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVO_OTCMain.cs"; Index: PVOLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOLogItem.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PVOLogItem.cs 29 Sep 2008 21:18:13 -0000 1.5 --- PVOLogItem.cs 12 Nov 2008 20:42:39 -0000 1.6 *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 40,53 **** namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator { ! /// <summary> ! /// LogItem for the PVO strategy ! /// portfolio value oscillator strategy ! /// </summary> ! [Serializable] ! public class PVOLogItem : LogItem ! { protected DummyTesterForTestingPositions[] dummyTestersForBestTestingPositionsInSample; ! protected TestingPositions[] bestPVOPositionsInSample; protected int numberOfEligibleTickers; protected double fitnessOfFirstPVOPositionsInSample; --- 40,53 ---- namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator { ! /// <summary> ! /// LogItem for the PVO strategy ! /// portfolio value oscillator strategy ! /// </summary> ! [Serializable] ! public class PVOLogItem : LogItem ! { protected DummyTesterForTestingPositions[] dummyTestersForBestTestingPositionsInSample; ! protected TestingPositions[] bestPVOPositionsInSample; protected int numberOfEligibleTickers; protected double fitnessOfFirstPVOPositionsInSample; *************** *** 67,72 **** if ( this.bestPVOPositionsInSample == null ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.bestPVOPositionsInSample; } --- 67,72 ---- if ( this.bestPVOPositionsInSample == null ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.bestPVOPositionsInSample; } *************** *** 79,84 **** if ( this.numberOfEligibleTickers == int.MinValue ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.numberOfEligibleTickers; } --- 79,84 ---- if ( this.numberOfEligibleTickers == int.MinValue ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.numberOfEligibleTickers; } *************** *** 91,96 **** if ( this.fitnessOfFirstPVOPositionsInSample == double.MinValue ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.fitnessOfFirstPVOPositionsInSample; } --- 91,96 ---- if ( this.fitnessOfFirstPVOPositionsInSample == double.MinValue ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.fitnessOfFirstPVOPositionsInSample; } *************** *** 103,108 **** if ( this.fitnessOfLastPVOPositionsInSample == double.MinValue ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.fitnessOfLastPVOPositionsInSample; } --- 103,108 ---- if ( this.fitnessOfLastPVOPositionsInSample == double.MinValue ) throw new Exception( "This property has not " + ! "been assigned yet! If you are loading the LogItem from " + ! "a log, this property was not set before logging the LogItem." ); return this.fitnessOfLastPVOPositionsInSample; } *************** *** 168,178 **** double minimumAcceptableGain = 0.007; HistoricalMarketValueProvider historicalQuoteProviderForBackTester, ! historicalQuoteProviderForInSampleChooser, ! historicalQuoteProviderForStrategy; historicalQuoteProviderForBackTester = new HistoricalAdjustedQuoteProvider(); historicalQuoteProviderForInSampleChooser = historicalQuoteProviderForBackTester; historicalQuoteProviderForStrategy = historicalQuoteProviderForInSampleChooser; ! IEligiblesSelector eligiblesSelector = new DummyEligibleSelector(); --- 168,178 ---- double minimumAcceptableGain = 0.007; HistoricalMarketValueProvider historicalQuoteProviderForBackTester, ! historicalQuoteProviderForInSampleChooser, ! historicalQuoteProviderForStrategy; historicalQuoteProviderForBackTester = new HistoricalAdjustedQuoteProvider(); historicalQuoteProviderForInSampleChooser = historicalQuoteProviderForBackTester; historicalQuoteProviderForStrategy = historicalQuoteProviderForInSampleChooser; ! IEligiblesSelector eligiblesSelector = new DummyEligibleSelector(); *************** *** 182,209 **** TestingPositions[] positionsToTest = //new TestingPositions[1]; ! // int idx = PVOLogItem.rand.Next(bestPVOPositionsInSample.Length); ! //positionsToTest[0] = this.bestPVOPositionsInSample[0]; ! positionsToTest = this.BestPVOPositionsInSample; PVOStrategy strategy = new PVOStrategy(eligiblesSelector, ! positionsToTest, this.numberOfInSampleDays, ! numDaysForOscillatingPeriodForOutOfSample, ! numberOfPortfolioPositions , benchmark , ! int.MaxValue , ! ((PVOPositions)positionsToTest[0]).OversoldThreshold, ! ((PVOPositions)positionsToTest[0]).OverboughtThreshold, ! historicalQuoteProviderForStrategy , ! maxAcceptableCloseToCloseDrawdown , minimumAcceptableGain ); EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "PVO" , strategy , ! historicalQuoteProviderForBackTester , ! new SimpleAccountProvider(), firstDateTime , ! lastDateTime , benchmark , cashToStart , maxRunningHours ); endOfDayStrategyBackTester.Run(); BackTesterReportViewer.ShowReport( lastDateTime , ! endOfDayStrategyBackTester ); } --- 182,213 ---- TestingPositions[] positionsToTest = //new TestingPositions[1]; ! // int idx = PVOLogItem.rand.Next(bestPVOPositionsInSample.Length); ! //positionsToTest[0] = this.bestPVOPositionsInSample[0]; ! positionsToTest = this.BestPVOPositionsInSample; PVOStrategy strategy = new PVOStrategy(eligiblesSelector, ! positionsToTest, this.numberOfInSampleDays, ! numDaysForOscillatingPeriodForOutOfSample, ! numberOfPortfolioPositions , benchmark , ! int.MaxValue , ! ((PVOPositions)positionsToTest[0]).OversoldThreshold, ! ((PVOPositions)positionsToTest[0]).OverboughtThreshold, ! historicalQuoteProviderForStrategy , ! maxAcceptableCloseToCloseDrawdown , minimumAcceptableGain ); EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "PVO" , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! benchmark.Ticker ) , ! strategy , ! historicalQuoteProviderForBackTester , ! new SimpleAccountProvider(), firstDateTime , ! lastDateTime , benchmark , cashToStart , maxRunningHours ); endOfDayStrategyBackTester.Run(); BackTesterReportViewer.ShowReport( lastDateTime , ! endOfDayStrategyBackTester ); } *************** *** 219,223 **** simulatedCreationDateTime ); } ! private void showTestingPositionsClickEventHandler_setDummyTesters() { --- 223,227 ---- simulatedCreationDateTime ); } ! private void showTestingPositionsClickEventHandler_setDummyTesters() { *************** *** 245,251 **** menuItems[0] = new MenuItem("Run Strategy"); menuItems[1] = new MenuItem("Show TestingPositions"); ! menuItems[0].Click += new System.EventHandler(this.runStrategyClickEventHandler); ! menuItems[1].Click += new System.EventHandler(this.showTestingPositionsClickEventHandler); ContextMenu contextMenu = new ContextMenu(menuItems); --- 249,255 ---- menuItems[0] = new MenuItem("Run Strategy"); menuItems[1] = new MenuItem("Show TestingPositions"); ! menuItems[0].Click += new System.EventHandler(this.runStrategyClickEventHandler); ! menuItems[1].Click += new System.EventHandler(this.showTestingPositionsClickEventHandler); ContextMenu contextMenu = new ContextMenu(menuItems); Index: PVOMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOMain.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PVOMain.cs 29 Sep 2008 21:18:13 -0000 1.7 --- PVOMain.cs 12 Nov 2008 20:42:39 -0000 1.8 *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 76,80 **** int maxNumberOfEligiblesToBeChosen = 100; ! string tickersGroupId = "SP500"; --- 76,80 ---- int maxNumberOfEligiblesToBeChosen = 100; ! string tickersGroupId = "SP500"; *************** *** 88,97 **** IEligiblesSelector eligiblesSelector = new ByPriceMostLiquidLessVolatileCTCAlwaysQuoted( ! tickersGroupId , temporizedGroup , ! maxNumberOfEligiblesToBeChosen , ! maxNumberOfMostLiquidTickersToBeChosen , ! numDaysForAverageRawOpenPriceComputation , ! numDaysForVolatility , ! minPrice , maxPrice ); // IEligiblesSelector eligiblesSelector = // new ByPriceMostLiquidAlwaysQuoted( --- 88,97 ---- IEligiblesSelector eligiblesSelector = new ByPriceMostLiquidLessVolatileCTCAlwaysQuoted( ! tickersGroupId , temporizedGroup , ! maxNumberOfEligiblesToBeChosen , ! maxNumberOfMostLiquidTickersToBeChosen , ! numDaysForAverageRawOpenPriceComputation , ! numDaysForVolatility , ! minPrice , maxPrice ); // IEligiblesSelector eligiblesSelector = // new ByPriceMostLiquidAlwaysQuoted( *************** *** 106,112 **** // numDaysForAverageRawOpenPriceComputation , // minPrice , maxPrice ); ! eligiblesSelector = new DummyEligibleSelector(); ! // return eligiblesSelector; } --- 106,112 ---- // numDaysForAverageRawOpenPriceComputation , // minPrice , maxPrice ); ! eligiblesSelector = new DummyEligibleSelector(); ! // return eligiblesSelector; } *************** *** 135,147 **** //correlation is computed only for returns //between minimum and maximum ! IInSampleChooser inSampleChooser = ! // new PVO_CTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, // closeToCloseIntervalLengthForCorrelation , maxCorrelationAllowed , balancedWeightsOnVolatilityBase, // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker ); ! new PVO_CTCStrongCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! maxCorrelationAllowed , minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, ! balancedWeightsOnVolatilityBase, this.benchmark.Ticker ); ! // IInSampleChooser inSampleChooser = ! // new PVO_OTCCTOCorrelationChooser(numberOfBestTestingPositionsToBeReturned, // maxCorrelationAllowed , balancedWeightsOnVolatilityBase, // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue); --- 135,147 ---- //correlation is computed only for returns //between minimum and maximum ! IInSampleChooser inSampleChooser = ! // new PVO_CTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, // closeToCloseIntervalLengthForCorrelation , maxCorrelationAllowed , balancedWeightsOnVolatilityBase, // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker ); ! new PVO_CTCStrongCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! maxCorrelationAllowed , minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, ! balancedWeightsOnVolatilityBase, this.benchmark.Ticker ); ! // IInSampleChooser inSampleChooser = ! // new PVO_OTCCTOCorrelationChooser(numberOfBestTestingPositionsToBeReturned, // maxCorrelationAllowed , balancedWeightsOnVolatilityBase, // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue); *************** *** 152,159 **** // numberOfBestTestingPositionsToBeReturned); //home ! inSampleChooser = ! new PVOChooserFromSavedBackTestLog( ! @"C:\Utente\MarcoVarie\Vari\qP\LogArchive\2008_06_03_18_33_29_PVO_CTC_from_2001_01_01_to_2004_12_31_annlRtrn_4.72_maxDD_13.57\2008_06_03_18_33_29_PVO_CTC_from_2001_01_01_to_2004_12_31_annlRtrn_4.72_maxDD_13.57.qpL", ! numberOfBestTestingPositionsToBeReturned); return inSampleChooser; } --- 152,159 ---- // numberOfBestTestingPositionsToBeReturned); //home ! inSampleChooser = ! new PVOChooserFromSavedBackTestLog( ! @"C:\Utente\MarcoVarie\Vari\qP\LogArchive\2008_06_03_18_33_29_PVO_CTC_from_2001_01_01_to_2004_12_31_annlRtrn_4.72_maxDD_13.57\2008_06_03_18_33_29_PVO_CTC_from_2001_01_01_to_2004_12_31_annlRtrn_4.72_maxDD_13.57.qpL", ! numberOfBestTestingPositionsToBeReturned); return inSampleChooser; } *************** *** 176,185 **** // inSampleDays , benchmark , numDaysBetweenEachOptimization , // oversoldThreshold , overboughtThreshold , historicalQuoteProvider); ! // = new PVOStrategy(eligiblesSelector , inSampleChooser , ! inSampleDays , closeToCloseIntervalLength , 2 , benchmark , numDaysBetweenEachOptimization , ! oversoldThreshold , overboughtThreshold , ! oversoldThresholdMAX , overboughtThresholdMAX , historicalQuoteProvider, ! maxAcceptableDrawDown, minimumAcceptableGain ); return strategyForBacktester; } --- 176,185 ---- // inSampleDays , benchmark , numDaysBetweenEachOptimization , // oversoldThreshold , overboughtThreshold , historicalQuoteProvider); ! // = new PVOStrategy(eligiblesSelector , inSampleChooser , ! inSampleDays , closeToCloseIntervalLength , 2 , benchmark , numDaysBetweenEachOptimization , ! oversoldThreshold , overboughtThreshold , ! oversoldThresholdMAX , overboughtThresholdMAX , historicalQuoteProvider, ! maxAcceptableDrawDown, minimumAcceptableGain ); return strategyForBacktester; } *************** *** 203,210 **** EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , this.strategyForBacktester , ! quoteProviderForBackTester , accountProvider , ! firstDateTime , lastDateTime , ! this.benchmark , cashToStart , maxRunningHours ); return endOfDayStrategyBackTester; } --- 203,214 ---- EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! this.benchmark.Ticker ) , ! this.strategyForBacktester , ! quoteProviderForBackTester , accountProvider , ! firstDateTime , lastDateTime , ! this.benchmark , cashToStart , maxRunningHours ); return endOfDayStrategyBackTester; } *************** *** 225,234 **** { string returnValue; ! string fullPathFileNameForMainAtHome = @"C:\Quant\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVOMain.cs"; if( File.Exists(fullPathFileNameForMainAtHome) ) returnValue = fullPathFileNameForMainAtHome; else ! returnValue = @"C:\Utente\MarcoVarie\Vari\qP\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVOMain.cs"; --- 229,238 ---- { string returnValue; ! string fullPathFileNameForMainAtHome = @"C:\Quant\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVOMain.cs"; if( File.Exists(fullPathFileNameForMainAtHome) ) returnValue = fullPathFileNameForMainAtHome; else ! returnValue = @"C:\Utente\MarcoVarie\Vari\qP\QuantProject\b7_Scripts\TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\PVOMain.cs"; Index: PVO_CTOLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_CTOLogItem.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVO_CTOLogItem.cs 29 Sep 2008 21:17:47 -0000 1.2 --- PVO_CTOLogItem.cs 12 Nov 2008 20:42:39 -0000 1.3 *************** *** 95,99 **** EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "PVO_CTO" , strategy , historicalQuoteProviderForBackTester , new SimpleAccountProvider(), --- 95,103 ---- EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! "PVO_CTO" , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! benchmark.Ticker ) , ! strategy , historicalQuoteProviderForBackTester , new SimpleAccountProvider(), Index: PVO_CTOMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVO_CTOMain.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVO_CTOMain.cs 29 Sep 2008 21:17:48 -0000 1.3 --- PVO_CTOMain.cs 12 Nov 2008 20:42:39 -0000 1.4 *************** *** 216,220 **** EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , this.strategyForBacktester , quoteProviderForBackTester , accountProvider , firstDateTime , lastDateTime , --- 216,224 ---- EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( ! backTestId , ! new QuantProject.Business.Timing.IndexBasedEndOfDayTimer( ! HistoricalEndOfDayTimer.GetMarketOpen( firstDateTime ) , ! this.benchmark.Ticker ) , ! this.strategyForBacktester , quoteProviderForBackTester , accountProvider , firstDateTime , lastDateTime , |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:40:48
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13728/b3_Data/DataTables Modified Files: Bars.cs Log Message: The following new method has been added: public static History GetMarketDateTimes( string ticker , DateTime firstDateTime , DateTime lastDateTime , List< Time > dailyTimes ) Index: Bars.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/Bars.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Bars.cs 9 Nov 2008 19:17:55 -0000 1.1 --- Bars.cs 12 Nov 2008 20:40:43 -0000 1.2 *************** *** 3,7 **** Bars.cs ! Copyright (C) 2008 Marco Milletti --- 3,7 ---- Bars.cs ! Copyright (C) 2008 Marco Milletti *************** *** 19,26 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; using System.Collections; using System.Data; using System.Runtime.Serialization; --- 19,27 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; using System.Collections; + using System.Collections.Generic; using System.Data; using System.Runtime.Serialization; *************** *** 31,34 **** --- 32,36 ---- using QuantProject.ADT.Statistics; using QuantProject.ADT.Histories; + using QuantProject.ADT.Timing; using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; *************** *** 43,47 **** { public static string TickerFieldName = "baTicker"; // Ticker cannot be simply used because ! public static string Exchange = "baExchange"; public static string DateTimeForOpen = "baDateTimeForOpen"; public static string IntervalFrameInSeconds = "baInterval"; --- 45,49 ---- { public static string TickerFieldName = "baTicker"; // Ticker cannot be simply used because ! public static string Exchange = "baExchange"; public static string DateTimeForOpen = "baDateTimeForOpen"; public static string IntervalFrameInSeconds = "baInterval"; *************** *** 61,65 **** public Bars( ICollection tickerCollection , DateTime dateTime ) { ! QuantProject.DataAccess.Tables.Bars.SetDataTable( tickerCollection , dateTime , this ); } --- 63,67 ---- public Bars( ICollection tickerCollection , DateTime dateTime ) { ! QuantProject.DataAccess.Tables.Bars.SetDataTable( tickerCollection , dateTime , this ); } *************** *** 91,95 **** if ( !marketDateTimes.ContainsKey( (DateTime)dataRow[ Bars.DateTimeForOpen ] ) ) ! dataRowsToBeRemoved.Add( dataRow ); return dataRowsToBeRemoved; } --- 93,97 ---- if ( !marketDateTimes.ContainsKey( (DateTime)dataRow[ Bars.DateTimeForOpen ] ) ) ! dataRowsToBeRemoved.Add( dataRow ); return dataRowsToBeRemoved; } *************** *** 103,107 **** ArrayList dataRowsToBeRemoved = this.removeNonContainedDateTimes_getDataRowsToBeRemoved( ! marketDateTimes ); this.removeDataRows( dataRowsToBeRemoved ); } --- 105,109 ---- ArrayList dataRowsToBeRemoved = this.removeNonContainedDateTimes_getDataRowsToBeRemoved( ! marketDateTimes ); this.removeDataRows( dataRowsToBeRemoved ); } *************** *** 110,127 **** public Bars( string ticker ) { ! this.fillDataTable( ticker , QuantProject.DataAccess.Tables.Bars.GetFirstBarDateTime( ticker ) , QuantProject.DataAccess.Tables.Bars.GetLastBarDateTime( ticker ) ); } ! public Bars(SerializationInfo info, StreamingContext context) ! : base(info, context) ! { ! } private void fillDataTable( string ticker , DateTime startDateTime , DateTime endDateTime ) { ! QuantProject.DataAccess.Tables.Bars.SetDataTable( ticker , startDateTime , endDateTime , this ); ! this.setPrimaryKeys(); } private void setPrimaryKeys() --- 112,129 ---- public Bars( string ticker ) { ! this.fillDataTable( ticker , QuantProject.DataAccess.Tables.Bars.GetFirstBarDateTime( ticker ) , QuantProject.DataAccess.Tables.Bars.GetLastBarDateTime( ticker ) ); } ! public Bars(SerializationInfo info, StreamingContext context) ! : base(info, context) ! { ! } private void fillDataTable( string ticker , DateTime startDateTime , DateTime endDateTime ) { ! QuantProject.DataAccess.Tables.Bars.SetDataTable( ticker , startDateTime , endDateTime , this ); ! this.setPrimaryKeys(); } private void setPrimaryKeys() *************** *** 132,136 **** } ! /// <summary> /// returns date times when the ticker was exchanged, within a given /// date time interval --- 134,138 ---- } ! /// <summary> /// returns date times when the ticker was exchanged, within a given /// date time interval *************** *** 141,182 **** /// <returns></returns> public static History GetMarketDateTimes( string ticker , ! DateTime firstDateTime , DateTime lastDateTime ) { Bars bars = new Bars( ticker , firstDateTime , lastDateTime ); History marketDateTimes = new History(); ! int i = 0; foreach ( DataRow dataRow in bars.Rows ) ! { ! marketDateTimes.Add( (DateTime)dataRow[ Bars.DateTimeForOpen ] , (DateTime)dataRow[ Bars.DateTimeForOpen ] ); ! i++; ! } return marketDateTimes; } ! #region GetCommonMarketDateTimes private static Hashtable getMarketDateTimes( ICollection tickers , DateTime firstDateTime , ! DateTime lastDateTime ) { Hashtable marketDateTimes = new Hashtable(); foreach ( string ticker in tickers ) if ( !marketDateTimes.ContainsKey( ticker ) ) ! { ! SortedList marketDateTimesForSingleTicker = ! GetMarketDateTimes( ticker , firstDateTime , lastDateTime ); ! marketDateTimes.Add( ticker , marketDateTimesForSingleTicker ); ! } return marketDateTimes; } private static bool isCommonDateTime( ICollection tickers , DateTime dateTime , ! Hashtable marketDateTimes ) { bool itIsCommon = true; foreach ( string ticker in tickers ) itIsCommon = itIsCommon && ! ((SortedList)marketDateTimes[ ticker ]).ContainsKey( dateTime ); return itIsCommon; } private static void getCommonMarketDateTimes_ifTheCaseAdd( ICollection tickers , DateTime dateTime , ! Hashtable marketDateTimes , AdvancedSortedList commonMarketDateTimes ) { if ( isCommonDateTime( tickers , dateTime , marketDateTimes ) ) --- 143,270 ---- /// <returns></returns> public static History GetMarketDateTimes( string ticker , ! DateTime firstDateTime , DateTime lastDateTime ) { Bars bars = new Bars( ticker , firstDateTime , lastDateTime ); History marketDateTimes = new History(); ! // int i = 0; foreach ( DataRow dataRow in bars.Rows ) ! // { ! marketDateTimes.Add( ! (DateTime)dataRow[ Bars.DateTimeForOpen ] , ! (DateTime)dataRow[ Bars.DateTimeForOpen ] ); ! // i++; ! // } return marketDateTimes; } ! ! #region GetMarketDateTimes ! ! // #region checkIfAreTimes ! // private static void checkIfIsTime( DateTime timeCandidate ) ! // { ! // if ( !ExtendedDateTime.IsTime( timeCandidate ) ) ! // // the timeCandidate does not represent a time ! // throw new Exception( ! // "The given DateTime was expected to be a time, but " + ! // "it is not. Use QuantProject.ADT.ExtendedDateTime.GetTime() " + ! // "to build such times."; ! // } ! // private static void checkIfAreTimes( List< DateTime > dailyTimes ) ! // { ! // foreach ( DateTime dateTime in dailyTimes ) ! // this.checkIfIsTime( DateTime dateTime ); ! // } ! // #endregion checkIfAreTimes ! ! #region getMarketDateTimes ! ! #region removeMissingTimes ! ! #region removeMissingTime ! private static bool isTimeInDailyTimes( ! DateTime dateTime , List< Time > dailyTimes ) ! { ! Time time = new Time( dateTime ); ! bool isInDailyTimes = ! dailyTimes.Contains( time ); ! return isInDailyTimes; ! } ! private static void removeMissingTime( ! DateTime candidateToBeRemoved , ! List< Time > dailyTimes , History marketDateTimes ) ! { ! if ( !Bars.isTimeInDailyTimes( candidateToBeRemoved , dailyTimes ) ) ! // the candidate's time is not in the given list of daily times ! marketDateTimes.Remove( candidateToBeRemoved ); ! } ! #endregion removeMissingTime ! ! private static void removeMissingTimes( ! List< Time > dailyTimes , History marketDateTimes ) ! { ! foreach ( DateTime dateTime in marketDateTimes ) ! Bars.removeMissingTime( ! dateTime , dailyTimes , marketDateTimes ); ! } ! private static History getMarketDateTimes( ! string ticker , DateTime firstDateTime , DateTime lastDateTime , ! List< Time > dailyTimes ) ! { ! History marketDateTimes = ! Bars.GetMarketDateTimes( ! ticker , firstDateTime , lastDateTime ); ! Bars.removeMissingTimes( dailyTimes , marketDateTimes ); ! return marketDateTimes; ! } ! #endregion removeMissingTimes ! ! #endregion getMarketDateTimes ! ! /// <summary> ! /// returns date times when the ticker was exchanged, within a given ! /// date time interval, but only when the time is in dailyTimes ! /// </summary> ! /// <param name="ticker"></param> ! /// <param name="firstDateTime"></param> ! /// <param name="lastDateTime"></param> ! /// <param name="dailyTimes"></param> ! /// <returns></returns> ! public static History GetMarketDateTimes( ! string ticker , DateTime firstDateTime , DateTime lastDateTime , ! List< Time > dailyTimes ) ! { ! // Bars.checkIfAreTimes( dailyTimes ); ! History marketDateTimes = ! Bars.getMarketDateTimes( ! ticker , firstDateTime , lastDateTime , dailyTimes ); ! return marketDateTimes; ! } ! #endregion GetMarketDateTimes ! #region GetCommonMarketDateTimes private static Hashtable getMarketDateTimes( ICollection tickers , DateTime firstDateTime , ! DateTime lastDateTime ) { Hashtable marketDateTimes = new Hashtable(); foreach ( string ticker in tickers ) if ( !marketDateTimes.ContainsKey( ticker ) ) ! { ! History marketDateTimesForSingleTicker = ! GetMarketDateTimes( ticker , firstDateTime , lastDateTime ); ! marketDateTimes.Add( ticker , marketDateTimesForSingleTicker ); ! } return marketDateTimes; } private static bool isCommonDateTime( ICollection tickers , DateTime dateTime , ! Hashtable marketDateTimes ) { bool itIsCommon = true; foreach ( string ticker in tickers ) itIsCommon = itIsCommon && ! ((List< DateTime >)marketDateTimes[ ticker ]).Contains( dateTime ); return itIsCommon; } private static void getCommonMarketDateTimes_ifTheCaseAdd( ICollection tickers , DateTime dateTime , ! Hashtable marketDateTimes , AdvancedSortedList commonMarketDateTimes ) { if ( isCommonDateTime( tickers , dateTime , marketDateTimes ) ) *************** *** 184,188 **** } private static SortedList getCommonMarketDateTimes( ICollection tickers , ! DateTime firstDateTime , DateTime lastDateTime , Hashtable marketDateTimes ) { AdvancedSortedList commonMarketDateTimes = new AdvancedSortedList(); --- 272,276 ---- } private static SortedList getCommonMarketDateTimes( ICollection tickers , ! DateTime firstDateTime , DateTime lastDateTime , Hashtable marketDateTimes ) { AdvancedSortedList commonMarketDateTimes = new AdvancedSortedList(); *************** *** 190,195 **** while ( currentDateTime <= lastDateTime ) { ! getCommonMarketDateTimes_ifTheCaseAdd( tickers , ! currentDateTime , marketDateTimes , commonMarketDateTimes ); currentDateTime = currentDateTime.AddMinutes( 1 ); //CHECK this statement: it could be cause great delay ... --- 278,283 ---- while ( currentDateTime <= lastDateTime ) { ! getCommonMarketDateTimes_ifTheCaseAdd( tickers , ! currentDateTime , marketDateTimes , commonMarketDateTimes ); currentDateTime = currentDateTime.AddMinutes( 1 ); //CHECK this statement: it could be cause great delay ... *************** *** 199,206 **** public static SortedList GetCommonMarketDateTimes( ICollection tickers , ! DateTime firstDateTime , DateTime lastDateTime ) { Hashtable marketDateTimes = getMarketDateTimes( tickers , firstDateTime , lastDateTime ); ! return getCommonMarketDateTimes( tickers , firstDateTime , lastDateTime , marketDateTimes ); } --- 287,294 ---- public static SortedList GetCommonMarketDateTimes( ICollection tickers , ! DateTime firstDateTime , DateTime lastDateTime ) { Hashtable marketDateTimes = getMarketDateTimes( tickers , firstDateTime , lastDateTime ); ! return getCommonMarketDateTimes( tickers , firstDateTime , lastDateTime , marketDateTimes ); } *************** *** 216,236 **** } ! /// <summary> ! /// Gets the dateTime of the first bar contained into the Bars object ! /// </summary> ! /// <returns></returns> ! public DateTime StartDateTime ! { ! get{ return ((DateTime)this.Rows[ 0 ][ Bars.DateTimeForOpen ]); } ! } ! /// <summary> ! /// Gets the dateTime of the last bar contained into the Bars object ! /// </summary> ! /// <returns></returns> ! public DateTime EndDateTime ! { ! get{ return ((DateTime)this.Rows[ this.Rows.Count - 1 ][ Bars.DateTimeForOpen ]); } ! } ! #region GetHashValue /* --- 304,324 ---- } ! /// <summary> ! /// Gets the dateTime of the first bar contained into the Bars object ! /// </summary> ! /// <returns></returns> ! public DateTime StartDateTime ! { ! get{ return ((DateTime)this.Rows[ 0 ][ Bars.DateTimeForOpen ]); } ! } ! /// <summary> ! /// Gets the dateTime of the last bar contained into the Bars object ! /// </summary> ! /// <returns></returns> ! public DateTime EndDateTime ! { ! get{ return ((DateTime)this.Rows[ this.Rows.Count - 1 ][ Bars.DateTimeForOpen ]); } ! } ! #region GetHashValue /* *************** *** 302,306 **** return HashProvider.GetHashValue( getHashValue_getQuoteString( quotes ) ); } ! */ #endregion --- 390,394 ---- return HashProvider.GetHashValue( getHashValue_getQuoteString( quotes ) ); } ! */ #endregion *************** *** 325,330 **** setHistory(); return (DateTime) history.GetKey( Math.Max( 0 , ! history.IndexOfKeyOrPrevious( dateTime ) - ! precedingMinutes ) ); } --- 413,418 ---- setHistory(); return (DateTime) history.GetKey( Math.Max( 0 , ! history.IndexOfKeyOrPrevious( dateTime ) - ! precedingMinutes ) ); } *************** *** 346,350 **** { followingDateTime = (DateTime) history.GetKey( Math.Max( 0 , ! indexOfKeyOrPrevious + followingMinutes ) ); } catch ( ArgumentOutOfRangeException exception ) --- 434,438 ---- { followingDateTime = (DateTime) history.GetKey( Math.Max( 0 , ! indexOfKeyOrPrevious + followingMinutes ) ); } catch ( ArgumentOutOfRangeException exception ) *************** *** 352,430 **** string message = exception.Message; throw new Exception( "Quotes.GetFollowingDateTime() error: there is not " + ! "a dateTime for dateTime=" + dateTime.ToString() + ! " and followingMinutes=" + followingMinutes ); } return followingDateTime; } ! ! /// <summary> ! /// Returns true if a bar is available at the given dateTime ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public bool HasDateTime( DateTime dateTime ) ! { ! /*alternative code, but primary keys need to be set first bool hasDate; hasDate = this.Rows.Contains(date.Date); return hasDate;*/ ! setHistory(); ! return this.history.ContainsKey(dateTime); ! } ! /// <summary> ! /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, ! /// else it returns the immediate following dateTime at which a bar is available ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public DateTime GetBarDateTimeOrFollowing( DateTime dateTime ) ! { ! if( this.HasDateTime( dateTime ) ) ! { ! return dateTime; ! } ! else ! { ! return GetBarDateTimeOrFollowing( dateTime.AddMinutes( 1 ) ); ! } ! } ! /// <summary> ! /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, ! /// else it returns the immediate preceding dateTime at which a bar is available ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public DateTime GetBarDateTimeOrPreceding( DateTime dateTime ) ! { ! if( this.HasDateTime( dateTime ) ) ! { ! return dateTime; ! } ! else ! { ! return GetBarDateTimeOrPreceding( dateTime.AddMinutes( - 1 ) ); ! } ! } ! /// <summary> ! /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, ! /// else it returns the first valid following dateTime at which a bar is available ! /// (or the first valid preceding dateTime, in case dateTime is >= the dateTime of the last available bar) ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public DateTime GetFirstValidBarDateTime(DateTime dateTime) ! { ! DateTime startDateTime = this.StartDateTime; ! DateTime endDateTime = this.EndDateTime; ! if( dateTime < startDateTime || (dateTime>=startDateTime && dateTime<=endDateTime)) ! { ! return this.GetBarDateTimeOrFollowing(dateTime); ! } ! else ! { ! return this.GetBarDateTimeOrPreceding(dateTime); ! } ! } /// <summary> /// returns the first bar dateTime for the ticker --- 440,518 ---- string message = exception.Message; throw new Exception( "Quotes.GetFollowingDateTime() error: there is not " + ! "a dateTime for dateTime=" + dateTime.ToString() + ! " and followingMinutes=" + followingMinutes ); } return followingDateTime; } ! ! /// <summary> ! /// Returns true if a bar is available at the given dateTime ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public bool HasDateTime( DateTime dateTime ) ! { ! /*alternative code, but primary keys need to be set first bool hasDate; hasDate = this.Rows.Contains(date.Date); return hasDate;*/ ! setHistory(); ! return this.history.ContainsKey(dateTime); ! } ! /// <summary> ! /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, ! /// else it returns the immediate following dateTime at which a bar is available ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public DateTime GetBarDateTimeOrFollowing( DateTime dateTime ) ! { ! if( this.HasDateTime( dateTime ) ) ! { ! return dateTime; ! } ! else ! { ! return GetBarDateTimeOrFollowing( dateTime.AddMinutes( 1 ) ); ! } ! } ! /// <summary> ! /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, ! /// else it returns the immediate preceding dateTime at which a bar is available ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public DateTime GetBarDateTimeOrPreceding( DateTime dateTime ) ! { ! if( this.HasDateTime( dateTime ) ) ! { ! return dateTime; ! } ! else ! { ! return GetBarDateTimeOrPreceding( dateTime.AddMinutes( - 1 ) ); ! } ! } ! /// <summary> ! /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, ! /// else it returns the first valid following dateTime at which a bar is available ! /// (or the first valid preceding dateTime, in case dateTime is >= the dateTime of the last available bar) ! /// </summary> ! /// <param name="dateTime">dateTime</param> ! /// <returns></returns> ! public DateTime GetFirstValidBarDateTime(DateTime dateTime) ! { ! DateTime startDateTime = this.StartDateTime; ! DateTime endDateTime = this.EndDateTime; ! if( dateTime < startDateTime || (dateTime>=startDateTime && dateTime<=endDateTime)) ! { ! return this.GetBarDateTimeOrFollowing(dateTime); ! } ! else ! { ! return this.GetBarDateTimeOrPreceding(dateTime); ! } ! } /// <summary> /// returns the first bar dateTime for the ticker *************** *** 438,482 **** ! /// <summary> ! /// Gets the close at the given dateTime ! /// </summary> ! /// <returns></returns> ! public float GetClose(DateTime dateTime ) ! { ! object[] keys = new object[1]; ! keys[0] = dateTime.Date; ! DataRow foundRow = this.Rows.Find(keys); ! if(foundRow==null) ! throw new Exception("No bar for such a dateTime!"); ! return (float)foundRow[ Bars.Close ]; ! } ! /// <summary> ! /// Gets the first valid raw (not adjusted) close at the given date ! /// </summary> ! /// <returns></returns> ! public float GetFirstValidClose(DateTime dateTime ) ! { ! object[] keys = new object[1]; ! keys[0] = this.GetFirstValidBarDateTime(dateTime); ! DataRow foundRow = this.Rows.Find(keys); ! if(foundRow==null) ! throw new Exception("No bar for such a dateTime!"); ! return (float)foundRow[Bars.Close]; ! } ! ! /// <summary> ! /// Gets the first valid open at the given dateTime ! /// </summary> ! /// <returns></returns> ! public float GetFirstValidOpen(DateTime dateTime ) ! { ! object[] keys = new object[1]; ! keys[0] = this.GetFirstValidBarDateTime(dateTime); ! DataRow foundRow = this.Rows.Find(keys); ! if(foundRow==null) ! throw new Exception("No bar for such a dateTime!"); ! return (float)foundRow[Bars.Open]; ! } } } --- 526,570 ---- ! /// <summary> ! /// Gets the close at the given dateTime ! /// </summary> ! /// <returns></returns> ! public float GetClose(DateTime dateTime ) ! { ! object[] keys = new object[1]; ! keys[0] = dateTime.Date; ! DataRow foundRow = this.Rows.Find(keys); ! if(foundRow==null) ! throw new Exception("No bar for such a dateTime!"); ! return (float)foundRow[ Bars.Close ]; ! } ! /// <summary> ! /// Gets the first valid raw (not adjusted) close at the given date ! /// </summary> ! /// <returns></returns> ! public float GetFirstValidClose(DateTime dateTime ) ! { ! object[] keys = new object[1]; ! keys[0] = this.GetFirstValidBarDateTime(dateTime); ! DataRow foundRow = this.Rows.Find(keys); ! if(foundRow==null) ! throw new Exception("No bar for such a dateTime!"); ! return (float)foundRow[Bars.Close]; ! } ! ! /// <summary> ! /// Gets the first valid open at the given dateTime ! /// </summary> ! /// <returns></returns> ! public float GetFirstValidOpen(DateTime dateTime ) ! { ! object[] keys = new object[1]; ! keys[0] = this.GetFirstValidBarDateTime(dateTime); ! DataRow foundRow = this.Rows.Find(keys); ! if(foundRow==null) ! throw new Exception("No bar for such a dateTime!"); ! return (float)foundRow[Bars.Open]; ! } } } |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:38:27
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13498/b3_Data/DataProviders/Bars/Caching Modified Files: DailyBarCache.cs Log Message: private DateTime[] dailyTimes; is now private List< Time > dailyTimes; Index: DailyBarCache.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching/DailyBarCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DailyBarCache.cs 8 Nov 2008 20:19:44 -0000 1.1 --- DailyBarCache.cs 12 Nov 2008 20:38:21 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- using QuantProject.ADT; using QuantProject.ADT.Histories; + using QuantProject.ADT.Timing; using QuantProject.DataAccess; *************** *** 36,40 **** { private int barInterval; ! private DateTime[] dailyTimes; private int roughNumberOfItemsToBeCachedWithASingleQuery; --- 37,41 ---- { private int barInterval; ! private List< Time > dailyTimes; private int roughNumberOfItemsToBeCachedWithASingleQuery; *************** *** 57,61 **** public DailyBarCache( int barInterval , ! DateTime[] dailyTimes ) { this.checkParameters( dailyTimes ); --- 58,62 ---- public DailyBarCache( int barInterval , ! List< Time > dailyTimes ) { this.checkParameters( dailyTimes ); *************** *** 89,113 **** #region checkDailyTimesAreActuallyTimes ! private void checkIfItActuallyIsATime( DateTime dateTime ) ! { ! if ( !ExtendedDateTime.IsTime( dateTime ) ) ! throw new Exception( ! "dailyTimes have to be times: use the method " + ! "QuantProject.ADT.ExtendedDateTime.GetTime() " + ! "to build them" ); ! } ! private void checkDailyTimesAreActuallyTimes( DateTime[] dailyTimes ) ! { ! foreach ( DateTime dateTime in dailyTimes ) ! this.checkIfItActuallyIsATime( dateTime ); ! } #endregion checkDailyTimesAreActuallyTimes #region checkIfDailyTimesAreInStrictAscendingOrder private void checkIfDailyTimesAreInStrictAscendingOrder( ! int indexForCurrentDailyTime , DateTime[] dailyTimes ) { ! DateTime currentDailyTime = dailyTimes[ indexForCurrentDailyTime ]; ! DateTime nextDailyTime = dailyTimes[ indexForCurrentDailyTime + 1 ]; if ( currentDailyTime >= nextDailyTime ) throw new Exception( --- 90,116 ---- #region checkDailyTimesAreActuallyTimes ! // private void checkIfItActuallyIsATime( DateTime dateTime ) ! // { ! // if ( !ExtendedDateTime.IsTime( dateTime ) ) ! // throw new Exception( ! // "dailyTimes have to be times: use the method " + ! // "QuantProject.ADT.ExtendedDateTime.GetTime() " + ! // "to build them" ); ! // } ! // private void checkDailyTimesAreActuallyTimes( DateTime[] dailyTimes ) ! // { ! // foreach ( DateTime dateTime in dailyTimes ) ! // this.checkIfItActuallyIsATime( dateTime ); ! // } #endregion checkDailyTimesAreActuallyTimes #region checkIfDailyTimesAreInStrictAscendingOrder private void checkIfDailyTimesAreInStrictAscendingOrder( ! int indexForCurrentDailyTime , List< Time > dailyTimes ) { ! Time currentDailyTime = ! dailyTimes[ indexForCurrentDailyTime ]; ! Time nextDailyTime = ! dailyTimes[ indexForCurrentDailyTime + 1 ]; if ( currentDailyTime >= nextDailyTime ) throw new Exception( *************** *** 119,125 **** " while it should <" ); } ! private void checkIfDailyTimesAreInStrictAscendingOrder( DateTime[] dailyTimes ) { ! for ( int index = 0 ; index < dailyTimes.Length - 1 ; index++ ) this.checkIfDailyTimesAreInStrictAscendingOrder( index , dailyTimes ); --- 122,128 ---- " while it should <" ); } ! private void checkIfDailyTimesAreInStrictAscendingOrder( List< Time > dailyTimes ) { ! for ( int index = 0 ; index < dailyTimes.Count - 1 ; index++ ) this.checkIfDailyTimesAreInStrictAscendingOrder( index , dailyTimes ); *************** *** 127,133 **** #endregion checkIfDailyTimesAreInStrictAscendingOrder ! private void checkParameters( DateTime[] dailyTimes ) { ! this.checkDailyTimesAreActuallyTimes( dailyTimes ); this.checkIfDailyTimesAreInStrictAscendingOrder( dailyTimes ); } --- 130,136 ---- #endregion checkIfDailyTimesAreInStrictAscendingOrder ! private void checkParameters( List< Time > dailyTimes ) { ! // this.checkDailyTimesAreActuallyTimes( dailyTimes ); this.checkIfDailyTimesAreInStrictAscendingOrder( dailyTimes ); } *************** *** 170,174 **** int numberOfDaysToBeCachedForASingleQuery = this.roughNumberOfItemsToBeCachedWithASingleQuery / ! this.dailyTimes.Length; return numberOfDaysToBeCachedForASingleQuery; } --- 173,177 ---- int numberOfDaysToBeCachedForASingleQuery = this.roughNumberOfItemsToBeCachedWithASingleQuery / ! this.dailyTimes.Count; return numberOfDaysToBeCachedForASingleQuery; } |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:37:31
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13437/b2_DataAccess Modified Files: SQLBuilder.cs Log Message: The signature for the method public static string GetTimeConstant( DateTime dateTime ) has become public static string GetTimeConstant( Time time ) Index: SQLBuilder.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/SQLBuilder.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SQLBuilder.cs 8 Nov 2008 20:31:17 -0000 1.2 --- SQLBuilder.cs 12 Nov 2008 20:37:28 -0000 1.3 *************** *** 24,27 **** --- 24,28 ---- using QuantProject.ADT; + using QuantProject.ADT.Timing; namespace QuantProject.DataAccess *************** *** 68,78 **** #region GetTimeConstant ! public static string GetTimeConstant( DateTime dateTime ) { string timeConstant = "'" + ! dateTime.Hour.ToString( "00" ) + "." + ! dateTime.Minute.ToString( "00" ) + "." + ! dateTime.Second.ToString( "00" ) + "'"; return timeConstant; } --- 69,79 ---- #region GetTimeConstant ! public static string GetTimeConstant( Time time ) { string timeConstant = "'" + ! time.Hour.ToString( "00" ) + "." + ! time.Minute.ToString( "00" ) + "." + ! time.Second.ToString( "00" ) + "'"; return timeConstant; } *************** *** 80,97 **** #region GetFilterForTime ! private static void getFilterForTime_checkParameters( DateTime time ) ! { ! // if ( ( comparisonOperator != "=" ) && ! // ( comparisonOperator != "<" ) && ! // ( comparisonOperator != "<=" ) && ! // ( comparisonOperator != ">" ) && ! // ( comparisonOperator != ">=" ) ) // throw new Exception( ! // "comparisonOperator can either be '=' or '<' or '<=' or '>' or '>='" ); ! if ( !ExtendedDateTime.IsTime( time ) ) ! throw new Exception( ! "time is actually not a time. Use the method " + ! "QuantProject.ADT.ExtendedDateTime.GetTime() to build your time" ); ! } #region getFilterForTime_actually --- 81,98 ---- #region GetFilterForTime ! // private static void getFilterForTime_checkParameters( DateTime time ) ! // { ! //// if ( ( comparisonOperator != "=" ) && ! //// ( comparisonOperator != "<" ) && ! //// ( comparisonOperator != "<=" ) && ! //// ( comparisonOperator != ">" ) && ! //// ( comparisonOperator != ">=" ) ) ! //// throw new Exception( ! //// "comparisonOperator can either be '=' or '<' or '<=' or '>' or '>='" ); ! // if ( !ExtendedDateTime.IsTime( time ) ) // throw new Exception( ! // "time is actually not a time. Use the method " + ! // "QuantProject.ADT.ExtendedDateTime.GetTime() to build your time" ); ! // } #region getFilterForTime_actually *************** *** 121,130 **** } private static string getFilterForTime_actually( ! string fieldName , SqlComparisonOperator sqlComparisonOperator , DateTime time ) { string filterForDailyTime = "(Format([baDateTimeForOpen],'hh:mm:ss')" + SQLBuilder.getSqlStringForComparisonOperator( sqlComparisonOperator ) + ! SQLBuilder.GetTimeConstant( time ); return filterForDailyTime; } --- 122,131 ---- } private static string getFilterForTime_actually( ! string fieldName , SqlComparisonOperator sqlComparisonOperator , Time time ) { string filterForDailyTime = "(Format([baDateTimeForOpen],'hh:mm:ss')" + SQLBuilder.getSqlStringForComparisonOperator( sqlComparisonOperator ) + ! SQLBuilder.GetTimeConstant( time ) + ")"; return filterForDailyTime; } *************** *** 141,147 **** /// <returns></returns> internal static string GetFilterForTime( ! string fieldName , SqlComparisonOperator sqlComparisonOperator , DateTime time ) { ! SQLBuilder.getFilterForTime_checkParameters( time ); string filterForTime = SQLBuilder.getFilterForTime_actually( --- 142,148 ---- /// <returns></returns> internal static string GetFilterForTime( ! string fieldName , SqlComparisonOperator sqlComparisonOperator , Time time ) { ! // SQLBuilder.getFilterForTime_checkParameters( time ); string filterForTime = SQLBuilder.getFilterForTime_actually( |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:36:31
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13271/b2_DataAccess Modified Files: DataBase.cs Log Message: The type of a parameter has been changed DateTime[] to List< Time > Index: DataBase.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataBase.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DataBase.cs 8 Nov 2008 20:29:09 -0000 1.10 --- DataBase.cs 12 Nov 2008 20:36:28 -0000 1.11 *************** *** 23,31 **** --- 23,34 ---- using System; using System.Collections; + using System.Collections.Generic; using System.Data; using System.Data.OleDb; using System.Windows.Forms; + using QuantProject.ADT; using QuantProject.ADT.Histories; + using QuantProject.ADT.Timing; namespace QuantProject.DataAccess *************** *** 211,222 **** // #endregion getFilterForDailyTime ! private static string getFilterForDailyTimes( DateTime[] dailyTimes ) { string filterForDailyTimes = ""; ! foreach( DateTime dateTime in dailyTimes ) filterForDailyTimes = filterForDailyTimes + SQLBuilder.GetFilterForTime( ! "baDateTimeForOpen" , SqlComparisonOperator.Equal , dateTime ) + " and "; filterForDailyTimes = filterForDailyTimes.Substring( --- 214,225 ---- // #endregion getFilterForDailyTime ! private static string getFilterForDailyTimes( List< Time > dailyTimes ) { string filterForDailyTimes = ""; ! foreach( Time time in dailyTimes ) filterForDailyTimes = filterForDailyTimes + SQLBuilder.GetFilterForTime( ! "baDateTimeForOpen" , SqlComparisonOperator.Equal , time ) + " and "; filterForDailyTimes = filterForDailyTimes.Substring( *************** *** 232,236 **** DateTime firstDateTime , DateTime lastDateTime , ! DateTime[] dailyTimes ) { string sql = --- 235,239 ---- DateTime firstDateTime , DateTime lastDateTime , ! List< Time > dailyTimes ) { string sql = *************** *** 258,262 **** DateTime firstDateTime , DateTime lastDateTime , ! DateTime[] dailyTimes ) { string sql = DataBase.getSqlForBarDataTable( --- 261,265 ---- DateTime firstDateTime , DateTime lastDateTime , ! List< Time > dailyTimes ) { string sql = DataBase.getSqlForBarDataTable( *************** *** 287,291 **** DateTime firstDateTime , DateTime lastDateTime , ! DateTime[] dailyTimes ) { DataTable barDataTable = DataBase.getBarDataTable( --- 290,294 ---- DateTime firstDateTime , DateTime lastDateTime , ! List< Time > dailyTimes ) { DataTable barDataTable = DataBase.getBarDataTable( |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:35:04
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13177/b3_Data Modified Files: Data_SD.csproj Log Message: DataTables\Bars.cs has been added Index: Data_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data_SD.csproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Data_SD.csproj 8 Nov 2008 20:22:11 -0000 1.4 --- Data_SD.csproj 12 Nov 2008 20:34:58 -0000 1.5 *************** *** 53,56 **** --- 53,57 ---- <Compile Include="DataProviders\Quotes\HistoricalQuotesProvider.cs" /> <Compile Include="DataProviders\Quotes\MarketStatusSwitch.cs" /> + <Compile Include="DataTables\Bars.cs" /> <Compile Include="ExtendedDataTable.cs" /> <Compile Include="FilterBuilder.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:34:40
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13142/b2_DataAccess Modified Files: DataAccess_SD.csproj Log Message: Tables\Bars.cs has been added Index: DataAccess_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/DataAccess_SD.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DataAccess_SD.csproj 8 Nov 2008 20:08:48 -0000 1.3 --- DataAccess_SD.csproj 12 Nov 2008 20:34:34 -0000 1.4 *************** *** 56,59 **** --- 56,60 ---- <Compile Include="SqlComparisonOperator.cs" /> <Compile Include="SqlExecutor.cs" /> + <Compile Include="Tables\Bars.cs" /> <Compile Include="ValidationTypes.cs" /> <Compile Include="Tables\FaultyTickers.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:34:16
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13062/b4_Business Modified Files: Business_SD.csproj Log Message: a05_Timing\IndexBasedHistoricalTimer.cs has been added Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Business_SD.csproj 8 Nov 2008 20:26:04 -0000 1.30 --- Business_SD.csproj 12 Nov 2008 20:34:09 -0000 1.31 *************** *** 46,49 **** --- 46,50 ---- </ItemGroup> <ItemGroup> + <Compile Include="a05_Timing\IndexBasedHistoricalTimer.cs" /> <Compile Include="a05_Timing\Timer.cs" /> <Compile Include="a07_DataProviders\HistoricalBarProvider.cs" /> |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:33:43
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a05_Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13006/b4_Business/a05_Timing Added Files: IndexBasedHistoricalTimer.cs Log Message: Throws out DateTime(s) at given daily times, but only if the given index is quoted at those DateTime(s) --- NEW FILE: IndexBasedHistoricalTimer.cs --- /* QuantProject - Quantitative Finance Library IndexBasedHistoricalTimer.cs Copyright (C) 2008 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections.Generic; using QuantProject.ADT.Histories; using QuantProject.ADT.Timing; using QuantProject.Data.DataTables; namespace QuantProject.Business.Timing { /// <summary> /// Throws out DateTime(s) at given daily times, but only if the given /// index is quoted at those DateTime(s) /// </summary> public class IndexBasedHistoricalTimer : Timer { private string indexTicker; DateTime firstDateTime; DateTime lastDateTime; List< Time > dailyTimes; List< DateTime > dateTimesToBeThrown; private int currentDateTimeIndex; public IndexBasedHistoricalTimer( string indexTicker , DateTime firstDateTime , DateTime lastDateTime , List< Time > dailyTimes ) { this.indexTicker = indexTicker; this.firstDateTime = firstDateTime; this.lastDateTime = lastDateTime; this.dailyTimes = dailyTimes; } #region initializeTimer #region initialize_dateTimesToBeThrown private void initialize_dateTimesToBeThrown( History dateTimesToBeThrownHistory ) { this.dateTimesToBeThrown = new List< DateTime >(); foreach ( DateTime dateTime in dateTimesToBeThrownHistory ) this.dateTimesToBeThrown.Add( dateTime ); } private void initialize_dateTimesToBeThrown() { History dateTimesToBeThrownHistory = Bars.GetMarketDateTimes( this.indexTicker , this.firstDateTime , this.lastDateTime , this.dailyTimes ); this.initialize_dateTimesToBeThrown( dateTimesToBeThrownHistory ); } #endregion initialize_dateTimesToBeThrown protected override void initializeTimer() { this.initialize_dateTimesToBeThrown(); this.currentDateTimeIndex = 0; this.currentDateTime = this.dateTimesToBeThrown[ currentDateTimeIndex ]; } #endregion initializeTimer #region moveNext private void checkIfNoMoreDateTimesAreToBeThrown() { if ( this.currentDateTimeIndex >= this.dateTimesToBeThrown.Count ) throw new Exception( "This timer has no other DateTime(s) to be thrown out. " + "This should never happen, the backtest should have invoked the method " + "QuantProject.Business.Timing.Timer.Stop() before gettint to this " + "point." ); } private void moveNext_actually() { this.currentDateTimeIndex++; this.currentDateTime = this.dateTimesToBeThrown[ currentDateTimeIndex ]; } protected override void moveNext() { this.checkIfNoMoreDateTimesAreToBeThrown(); this.moveNext_actually(); } #endregion moveNext } } |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:32:16
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12892/b1_ADT Modified Files: ADT_SD.csproj Log Message: Timing\Time.cs has been added Index: ADT_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/ADT_SD.csproj,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ADT_SD.csproj 7 Jun 2008 14:08:32 -0000 1.11 --- ADT_SD.csproj 12 Nov 2008 20:32:06 -0000 1.12 *************** *** 98,104 **** --- 98,106 ---- <Compile Include="Collections\FloatArrayManager.cs" /> <Compile Include="Collections\Set.cs" /> + <Compile Include="Timing\Time.cs" /> </ItemGroup> <ItemGroup> <Folder Include="Messaging" /> + <Folder Include="Timing" /> <Folder Include="Optimizing\BruteForce" /> <Folder Include="Optimizing\BruteForce\ParametersManagers" /> |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:31:56
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12834 Added Files: Time.cs Log Message: Represent a time (for any possible date) --- NEW FILE: Time.cs --- /* QuantProject - Quantitative Finance Library Time.cs Copyright (C) 2008 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; namespace QuantProject.ADT.Timing { /// <summary> /// Represent a time (for any possible date) /// </summary> public struct Time : IEquatable<Time> , IComparable<Time> { private DateTime standardDateTime; public int Hour { get { return this.standardDateTime.Hour; } } public int Minute { get { return this.standardDateTime.Minute; } } public int Second { get { return this.standardDateTime.Second; } } #region Equals and GetHashCode implementation // The code in this region is useful if you want to use this structure in collections. // If you don't need it, you can just remove the region and the ": IEquatable<Time>" declaration. public Time( int hour , int minute , int second ) { this.standardDateTime = new DateTime( 1900 , 1 , 1 , hour , minute , second ); } public Time( DateTime dateTime ) { this.standardDateTime = new DateTime( 1900 , 1 , 1 , dateTime.Hour , dateTime.Minute , dateTime.Second ); } public override bool Equals(object obj) { if (obj is Time) return Equals((Time)obj); // use Equals method below else return false; } public bool Equals(Time other) { // add comparisions for all members here return this.standardDateTime == other.standardDateTime; } public override int GetHashCode() { // combine the hash codes of all members here (e.g. with XOR operator ^) return standardDateTime.GetHashCode(); } public static bool operator ==(Time lhs, Time rhs) { return lhs.Equals(rhs); } public static bool operator !=(Time lhs, Time rhs) { return !(lhs.Equals(rhs)); // use operator == and negate result } #endregion Equals and GetHashCode implementation public static bool operator <=(Time lhs, Time rhs) { bool isLessThanOrEqual = ( lhs.standardDateTime <= rhs.standardDateTime ); return isLessThanOrEqual; } public static bool operator >=(Time lhs, Time rhs) { bool isGreaterThanOrEqual = ( lhs.standardDateTime >= rhs.standardDateTime ); return isGreaterThanOrEqual; } public static bool operator <(Time lhs, Time rhs) { bool isLessThan = ( lhs.standardDateTime < rhs.standardDateTime ); return isLessThan; } public static bool operator >(Time lhs, Time rhs) { bool isGreaterThan = ( lhs.standardDateTime > rhs.standardDateTime ); return isGreaterThan; } public int CompareTo(Time other) { int compareTo = 0; if ( this < other ) compareTo = -1; if ( this > other ) compareTo = 1; return compareTo; } } } |
|
From: Glauco S. <gla...@us...> - 2008-11-12 20:31:00
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12551/Timing Log Message: Directory /cvsroot/quantproject/QuantProject/b1_ADT/Timing added to the repository |
|
From: Marco M. <mi...@us...> - 2008-11-09 19:23:05
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Histories In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22539/b1_ADT/Histories Modified Files: History.cs Log Message: Added methods ContainsAllTheDateTimesIn and ContainsAtAGivenPercentageDateTimesIn Index: History.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Histories/History.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** History.cs 29 Sep 2008 21:12:26 -0000 1.14 --- History.cs 9 Nov 2008 19:23:02 -0000 1.15 *************** *** 126,129 **** --- 126,160 ---- } + /// <summary> + /// Returns true iif current history contains all the + /// dateTimes contained in the given comparingHistoryOfDateTimes + /// </summary> + public bool ContainsAllTheDateTimesIn( History comparingHistoryOfDateTimes ) + { + bool returnValue = true; + foreach ( DateTime dateTime in comparingHistoryOfDateTimes.Keys ) + if ( ! this.ContainsKey( dateTime ) ) + returnValue = false; + return returnValue; + } + + /// <summary> + /// Returns true iif current history contains at the given percentage the + /// dateTimes contained in the given comparingHistoryOfDateTimes + /// </summary> + public bool ContainsAtAGivenPercentageDateTimesIn( History comparingHistoryOfDateTimes, double percentageOfDateTimes ) + { + if(percentageOfDateTimes <= 0 || percentageOfDateTimes > 100) + throw new Exception ("invalid percentage"); + int numberOfContainedDateTimes = 0; + int numberOfComparingDateTimes = comparingHistoryOfDateTimes.Count; + foreach ( DateTime dateTime in comparingHistoryOfDateTimes.Keys ) + if ( this.ContainsKey( dateTime ) ) + numberOfContainedDateTimes++; + + return numberOfContainedDateTimes >= + (percentageOfDateTimes * numberOfComparingDateTimes)/100; + } + public void Interpolate( ICollection dateTimeCollection , IInterpolationMethod interpolationMethod ) |
|
From: Marco M. <mi...@us...> - 2008-11-09 19:22:17
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22501/b3_Data/DataTables Modified Files: TickerDataTable.cs Log Message: Added method GetTickersQuotedAtAGivenPercentageOfDateTimes Index: TickerDataTable.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/DataTables/TickerDataTable.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TickerDataTable.cs 19 Jan 2008 19:29:34 -0000 1.10 --- TickerDataTable.cs 9 Nov 2008 19:22:14 -0000 1.11 *************** *** 1,4 **** /* ! QuantDownloader - Quantitative Finance Library TickerDataTable.cs --- 1,4 ---- /* ! QuantProject - Quantitative Finance Library TickerDataTable.cs *************** *** 236,239 **** --- 236,327 ---- #endregion GetTickersQuotedInEachMarketDay + #region GetTickersQuotedAtEachDateTime + + private static void getTickersQuotedAtAGivenPercentageOfDateTimes_addRow(DataRow rowToBeAdded, int numberOfTradingDateTimes, + DataTable tableToWhichRowIsToBeAdded) + { + DataRow newRow = tableToWhichRowIsToBeAdded.NewRow(); + newRow[0]= rowToBeAdded[0]; + newRow["NumberOfBars"] = numberOfTradingDateTimes; + tableToWhichRowIsToBeAdded.Rows.Add(newRow); + } + + private static void getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow( + DataRow row , History marketDateTimes , double percentageOfDateTimes , + DateTime firstQuoteDate , DateTime lastQuoteDate , + DataTable tableToWhichRowIsToBeAdded ) + { + History dateTimesForTicker = Bars.GetMarketDateTimes( (string)row[0], + firstQuoteDate , lastQuoteDate ); + if( dateTimesForTicker.ContainsAtAGivenPercentageDateTimesIn( marketDateTimes , percentageOfDateTimes ) ) + //the current ticker has been effectively traded at the given percentage of times + //for the given market date times + TickerDataTable.getTickersQuotedAtAGivenPercentageOfDateTimes_addRow( + row , dateTimesForTicker.Count , tableToWhichRowIsToBeAdded ); + } + + + private static void addColumnNumberOfBars(DataTable tableToAnalyze) + { + if(!tableToAnalyze.Columns.Contains("NumberOfBars")) + tableToAnalyze.Columns.Add("NumberOfBars", System.Type.GetType("System.Int32")); + } + + public static DataTable GetTickersQuotedAtAGivenPercentageOfDateTimes(string marketIndex, double percentageOfDateTimes, + DataTable setOfTickers, + DateTime firstBarDateTime, DateTime lastBarDateTime, + long maxNumOfReturnedTickers) + { + History marketDateTimesForIndex = Bars.GetMarketDateTimes(marketIndex, + firstBarDateTime , lastBarDateTime); + return GetTickersQuotedAtAGivenPercentageOfDateTimes( + marketDateTimesForIndex , percentageOfDateTimes , setOfTickers , + firstBarDateTime , lastBarDateTime , maxNumOfReturnedTickers ); + } + + public static DataTable GetTickersQuotedAtAGivenPercentageOfDateTimes(string marketIndex, double percentageOfDateTimes, + string groupID, + DateTime firstBarDateTime, DateTime lastBarDateTime, + long maxNumOfReturnedTickers) + { + DataTable groupOfTicker = + QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers(groupID); + return GetTickersQuotedAtAGivenPercentageOfDateTimes( + marketIndex , percentageOfDateTimes , groupOfTicker , + firstBarDateTime , lastBarDateTime , maxNumOfReturnedTickers ); + } + + /// <summary> + /// Returns a dataTable containing tickers that are quoted + /// at a given percentage of time with respect to + /// a history of marketDateTimes + /// </summary> + /// <param name="percentageOfDateTimes">percentage (0 to 100) of times of quotation + /// with respect to a given history of marketDateTimes. For example: + /// with 50, it will be returned a dataTable with all the tickers + /// that have at least 0,5*(number of marketDateTimes) quoted dateTimes in common + /// with marketDateTimes</param> + /// <returns></returns> + public static DataTable GetTickersQuotedAtAGivenPercentageOfDateTimes( + History marketDateTimes, double percentageOfDateTimes, + DataTable setOfTickers, + DateTime firstBarDateTime, DateTime lastBarDateTime, + long maxNumOfReturnedTickers) + { + if(percentageOfDateTimes <= 0 || percentageOfDateTimes > 100) + throw new Exception ("invalid percentage"); + + TickerDataTable.addColumnNumberOfBars(setOfTickers); + DataTable returnValue = setOfTickers.Clone(); + foreach(DataRow row in setOfTickers.Rows) + getTickersQuotedAtAGivenPercentageOfDateTimes_handleRow( + row , marketDateTimes , percentageOfDateTimes , + firstBarDateTime , lastBarDateTime , returnValue ); + ExtendedDataTable.DeleteRows(returnValue, maxNumOfReturnedTickers); + return returnValue; + } + + #endregion GetTickersQuotedAtAGivenPercentageOfDateTimes + public static DataTable GetTickersQuotedInEachMarketDay(string marketIndex, DataTable setOfTickers, DateTime firstQuoteDate, |
|
From: Marco M. <mi...@us...> - 2008-11-09 19:21:54
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22483/b4_Business/a2_Strategies/Eligibles Added Files: ByPriceMostLiquidQuotedAtEachDateTime.cs Log Message: Added eligible selector ByPriceMostLiquidQuotedAtEachDateTime --- NEW FILE: ByPriceMostLiquidQuotedAtEachDateTime.cs --- /* QuantProject - Quantitative Finance Library ByPriceMostLiquidQuotedAtEachDateTime.cs Copyright (C) 2008 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using QuantProject.ADT.Histories; using QuantProject.ADT.Messaging; using QuantProject.Data.DataTables; using QuantProject.Data.Selectors; namespace QuantProject.Business.Strategies.Eligibles { /// <summary> /// Implements IEligiblesSelector for selecting a given max number of tickers through /// the following step-by-step selecting process: /// -step 1: all tickers belonging to a given group /// are selected (the group can be "temporized": that is tickers /// are returned depending on the time the selection is requested: /// the group SP 500 should be like that); /// -step 2: from tickers selected by step 1, the most liquid /// are selected (not more than a given max number); /// -step 3: from tickers selected by step 2, the ones that are /// always quoted at all given market dateTimes are selected (not more than a given max number); /// </summary> [Serializable] public class ByPriceMostLiquidQuotedAtEachDateTime : IEligiblesSelector { public event NewMessageEventHandler NewMessage; private bool temporizedGroup; private string tickersGroupID; private int maxNumberOfEligibleTickersToBeChosen; private int numOfDaysForAverageOpenRawPriceComputation; private double minPrice; private double maxPrice; private string marketIndex; public string Description { get{ return "From_" + this.tickersGroupID + " (temporized: " + this.temporizedGroup.ToString() + ")\n" + "MaxNumOfEligibles_" + this.maxNumberOfEligibleTickersToBeChosen.ToString() + "\n" + "AverageRawOpenPriceRange(computed for the last " + this.numOfDaysForAverageOpenRawPriceComputation.ToString() + "):\n" + "From_" + this.minPrice + "_to_" + this.maxPrice + "\n" + "Most Liquid and Always Quoted at each market day (^GSPC) for the in sample time frame"; } } public ByPriceMostLiquidQuotedAtEachDateTime( string tickersGroupID , bool temporizedGroup, int maxNumberOfEligibleTickersToBeChosen, int numOfDaysForAverageOpenRawPriceComputation, double minPrice, double maxPrice, string marketIndex) { this.temporizedGroup = temporizedGroup; this.tickersGroupID = tickersGroupID; this.maxNumberOfEligibleTickersToBeChosen = maxNumberOfEligibleTickersToBeChosen; this.numOfDaysForAverageOpenRawPriceComputation = numOfDaysForAverageOpenRawPriceComputation; this.minPrice = minPrice; this.maxPrice = maxPrice; this.marketIndex = marketIndex; } private EligibleTickers getEligibleTickers_actually( History history ) { DateTime currentDate = history.LastDateTime; SelectorByGroup group; if(this.temporizedGroup) //the group is "temporized": returned set of tickers // depend on time group = new SelectorByGroup(this.tickersGroupID, currentDate); else//the group is not temporized group = new SelectorByGroup(this.tickersGroupID); DataTable tickersFromGroup = group.GetTableOfSelectedTickers(); int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; SelectorByAverageRawOpenPrice byPrice = new SelectorByAverageRawOpenPrice(tickersFromGroup,false, currentDate.AddDays(-this.numOfDaysForAverageOpenRawPriceComputation), currentDate, numOfTickersInGroupAtCurrentDate, this.minPrice,this.maxPrice, 0.00001, double.MaxValue); DataTable dataTableByPrice = byPrice.GetTableOfSelectedTickers(); SelectorByLiquidity mostLiquidSelector = new SelectorByLiquidity( dataTableByPrice , false, history.FirstDateTime, currentDate, this.maxNumberOfEligibleTickersToBeChosen); DataTable dataTableMostLiquid = mostLiquidSelector.GetTableOfSelectedTickers(); // DataSet dataSet = new DataSet(); // dataSet.Tables.Add( dataTableMostLiquid ); // dataSet.WriteXml( "c:\\qpReports\\pairsTrading\\eligiblesCon_ByPriceMostLiquidAlwaysQuoted.xml" ); History marketDateTimes = Bars.GetMarketDateTimes(this.marketIndex,history.FirstDateTime, history.LastDateTime); double percentageOfDateTimes = 100.0; SelectorByQuotationAtAGivenPercentageOfDateTimes quotedAtPercOfDateTimesFromLastSelection = new SelectorByQuotationAtAGivenPercentageOfDateTimes( dataTableMostLiquid , false, marketDateTimes, this.maxNumberOfEligibleTickersToBeChosen, percentageOfDateTimes); DataTable dataTableToBeReturned = quotedAtPercOfDateTimesFromLastSelection.GetTableOfSelectedTickers(); return new EligibleTickers( dataTableToBeReturned ); } private void getEligibleTickers_sendNewMessage( EligibleTickers eligibleTickers ) { string message = "Number of Eligible tickers: " + eligibleTickers.Count; NewMessageEventArgs newMessageEventArgs = new NewMessageEventArgs( message ); if(this.NewMessage != null) this.NewMessage( this , newMessageEventArgs ); } /// <summary> /// Returns the eligible tickers /// </summary> /// <returns></returns> public EligibleTickers GetEligibleTickers( History history ) { EligibleTickers eligibleTickers = this.getEligibleTickers_actually( history ); this.getEligibleTickers_sendNewMessage( eligibleTickers ); return eligibleTickers; } } } |
|
From: Marco M. <mi...@us...> - 2008-11-09 19:20:38
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22404/b3_Data/Selectors Added Files: SelectorByQuotationAtAGivenPercentageOfDateTimes.cs Log Message: Added SelectorByQuotationAtAGivenPercentageOfDateTimes, for selecting tickers that have bars at a given percentage of DateTimed with respect to a given benchmark --- NEW FILE: SelectorByQuotationAtAGivenPercentageOfDateTimes.cs --- /* QuantProject - Quantitative Finance Library SelectorByQuotationAtAGivenPercentageOfDateTimes.cs Copyright (C) 2008 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Windows.Forms; using QuantProject.ADT.Histories; using QuantProject.DataAccess.Tables; using QuantProject.Data.DataTables; namespace QuantProject.Data.Selectors { /// <summary> /// Class for selection on tickers quoted at a given percentage of /// date times provided directly or through a given market index /// </summary> public class SelectorByQuotationAtAGivenPercentageOfDateTimes : TickerSelector , ITickerSelector { private string marketIndex; private History marketDateTimes; private double percentageOfDateTimes; public SelectorByQuotationAtAGivenPercentageOfDateTimes(DataTable setOfTickersToBeSelected, bool orderInASCmode, DateTime firstBarDateTime, DateTime lastBarDateTime, long maxNumOfReturnedTickers, string marketIndex, double percentageOfDateTimes): base(setOfTickersToBeSelected, orderInASCmode, firstBarDateTime, lastBarDateTime, maxNumOfReturnedTickers) { this.marketIndex = marketIndex; this.percentageOfDateTimes = percentageOfDateTimes; } public SelectorByQuotationAtAGivenPercentageOfDateTimes(string groupID, bool orderInASCmode, DateTime firstBarDateTime, DateTime lastBarDateTime, long maxNumOfReturnedTickers, string marketIndex, double percentageOfDateTimes): base(groupID, orderInASCmode, firstBarDateTime, lastBarDateTime, maxNumOfReturnedTickers) { this.marketIndex = marketIndex; this.percentageOfDateTimes = percentageOfDateTimes; } public SelectorByQuotationAtAGivenPercentageOfDateTimes( DataTable setOfTickersToBeSelected , bool orderInASCmode , History marketDateTimes , long maxNumOfReturnedTickers, double percentageOfDateTimes): base(setOfTickersToBeSelected , orderInASCmode , marketDateTimes.FirstDateTime , marketDateTimes.LastDateTime , maxNumOfReturnedTickers ) { this.marketIndex = ""; this.marketDateTimes = marketDateTimes; this.percentageOfDateTimes = percentageOfDateTimes; } #region GetTableOfSelectedTickers private DataTable getTableOfSelectedTickers_givenDateTimes() { DataTable dataTable = QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes( this.marketDateTimes , this.percentageOfDateTimes , this.setOfTickersToBeSelected , this.firstQuoteDate , this.lastQuoteDate , this.maxNumOfReturnedTickers ); return dataTable; } private DataTable getTableOfSelectedTickers_givenMarketIndex() { if(this.marketIndex == "") throw new Exception("You first need to set TickerSelector's property <<MarketIndex>>!"); if(this.setOfTickersToBeSelected == null) return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes( this.marketIndex, this.percentageOfDateTimes , this.groupID, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); else return QuantProject.Data.DataTables.TickerDataTable.GetTickersQuotedAtAGivenPercentageOfDateTimes( this.marketIndex, this.percentageOfDateTimes , this.setOfTickersToBeSelected, this.firstQuoteDate, this.lastQuoteDate, this.maxNumOfReturnedTickers); } public DataTable GetTableOfSelectedTickers() { if ( this.marketDateTimes != null ) // marketDateTimes has been passed to the constructor return this.getTableOfSelectedTickers_givenDateTimes(); else // marketIndex has been passed to the constructor return this.getTableOfSelectedTickers_givenMarketIndex(); } #endregion GetTableOfSelectedTickers public void SelectAllTickers() { ; } } } |
|
From: Marco M. <mi...@us...> - 2008-11-09 19:18:02
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/DataTables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22253/b3_Data/DataTables Added Files: Bars.cs Log Message: Added Bars object, providing methods concerning bars --- NEW FILE: Bars.cs --- /* QuantProject - Quantitative Finance Library Bars.cs Copyright (C) 2008 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Runtime.Serialization; using System.Text; using QuantProject.ADT; using QuantProject.ADT.Collections; using QuantProject.ADT.Statistics; using QuantProject.ADT.Histories; using QuantProject.DataAccess; using QuantProject.DataAccess.Tables; namespace QuantProject.Data.DataTables { /// <summary> /// DataTable for bars table data /// </summary> [Serializable] public class Bars : DataTable { public static string TickerFieldName = "baTicker"; // Ticker cannot be simply used because public static string Exchange = "baExchange"; public static string DateTimeForOpen = "baDateTimeForOpen"; public static string IntervalFrameInSeconds = "baInterval"; public static string Open = "baOpen"; public static string High = "baHigh"; public static string Low = "baLow"; public static string Close = "baClose"; public static string Volume = "baVolume"; private History history; /// <summary> /// Builds a Bars data table containing a row for each ticker in the /// collection, with the bars for the given DateTime /// </summary> /// <param name="tickerCollection">Tickers whose quotes are to be fetched</param> /// <param name="dateTime">DateTime for the bars to be fetched</param> public Bars( ICollection tickerCollection , DateTime dateTime ) { QuantProject.DataAccess.Tables.Bars.SetDataTable( tickerCollection , dateTime , this ); } public Bars( string ticker , DateTime startDateTime , DateTime endDateTime ) { this.fillDataTable( ticker , startDateTime , endDateTime ); } /// <summary> /// builds a Bars data table containing the ticker's bars for the /// market dateTimes contained in the marketDateTimes SortedList /// </summary> /// <param name="ticker"></param> /// <param name="marketDateTimes"></param> public Bars( string ticker , SortedList marketDateTimes ) { DateTime firstDateTime = (DateTime)marketDateTimes.GetByIndex( 0 ); DateTime lastDateTime = (DateTime)marketDateTimes.GetByIndex( marketDateTimes.Count - 1 ); this.fillDataTable( ticker , firstDateTime , lastDateTime ); this.removeNonContainedDateTimes( marketDateTimes ); } #region removeNonContainedDateTimes private ArrayList removeNonContainedDateTimes_getDataRowsToBeRemoved( SortedList marketDateTimes ) { ArrayList dataRowsToBeRemoved = new ArrayList(); foreach( DataRow dataRow in this.Rows ) if ( !marketDateTimes.ContainsKey( (DateTime)dataRow[ Bars.DateTimeForOpen ] ) ) dataRowsToBeRemoved.Add( dataRow ); return dataRowsToBeRemoved; } private void removeDataRows( ICollection dataRowsToBeRemoved ) { foreach ( DataRow dataRowToBeRemoved in dataRowsToBeRemoved ) this.Rows.Remove( dataRowToBeRemoved ); } private void removeNonContainedDateTimes( SortedList marketDateTimes ) { ArrayList dataRowsToBeRemoved = this.removeNonContainedDateTimes_getDataRowsToBeRemoved( marketDateTimes ); this.removeDataRows( dataRowsToBeRemoved ); } #endregion public Bars( string ticker ) { this.fillDataTable( ticker , QuantProject.DataAccess.Tables.Bars.GetFirstBarDateTime( ticker ) , QuantProject.DataAccess.Tables.Bars.GetLastBarDateTime( ticker ) ); } public Bars(SerializationInfo info, StreamingContext context) : base(info, context) { } private void fillDataTable( string ticker , DateTime startDateTime , DateTime endDateTime ) { QuantProject.DataAccess.Tables.Bars.SetDataTable( ticker , startDateTime , endDateTime , this ); this.setPrimaryKeys(); } private void setPrimaryKeys() { DataColumn[] columnPrimaryKeys = new DataColumn[1]; columnPrimaryKeys[0] = this.Columns[Bars.DateTimeForOpen]; this.PrimaryKey = columnPrimaryKeys; } /// <summary> /// returns date times when the ticker was exchanged, within a given /// date time interval /// </summary> /// <param name="ticker"></param> /// <param name="firstDateTime">begin interval</param> /// <param name="lastDateTime">end interval</param> /// <returns></returns> public static History GetMarketDateTimes( string ticker , DateTime firstDateTime , DateTime lastDateTime ) { Bars bars = new Bars( ticker , firstDateTime , lastDateTime ); History marketDateTimes = new History(); int i = 0; foreach ( DataRow dataRow in bars.Rows ) { marketDateTimes.Add( (DateTime)dataRow[ Bars.DateTimeForOpen ] , (DateTime)dataRow[ Bars.DateTimeForOpen ] ); i++; } return marketDateTimes; } #region GetCommonMarketDateTimes private static Hashtable getMarketDateTimes( ICollection tickers , DateTime firstDateTime , DateTime lastDateTime ) { Hashtable marketDateTimes = new Hashtable(); foreach ( string ticker in tickers ) if ( !marketDateTimes.ContainsKey( ticker ) ) { SortedList marketDateTimesForSingleTicker = GetMarketDateTimes( ticker , firstDateTime , lastDateTime ); marketDateTimes.Add( ticker , marketDateTimesForSingleTicker ); } return marketDateTimes; } private static bool isCommonDateTime( ICollection tickers , DateTime dateTime , Hashtable marketDateTimes ) { bool itIsCommon = true; foreach ( string ticker in tickers ) itIsCommon = itIsCommon && ((SortedList)marketDateTimes[ ticker ]).ContainsKey( dateTime ); return itIsCommon; } private static void getCommonMarketDateTimes_ifTheCaseAdd( ICollection tickers , DateTime dateTime , Hashtable marketDateTimes , AdvancedSortedList commonMarketDateTimes ) { if ( isCommonDateTime( tickers , dateTime , marketDateTimes ) ) commonMarketDateTimes.Add( dateTime , dateTime ); } private static SortedList getCommonMarketDateTimes( ICollection tickers , DateTime firstDateTime , DateTime lastDateTime , Hashtable marketDateTimes ) { AdvancedSortedList commonMarketDateTimes = new AdvancedSortedList(); DateTime currentDateTime = firstDateTime; while ( currentDateTime <= lastDateTime ) { getCommonMarketDateTimes_ifTheCaseAdd( tickers , currentDateTime , marketDateTimes , commonMarketDateTimes ); currentDateTime = currentDateTime.AddMinutes( 1 ); //CHECK this statement: it could be cause great delay ... } return commonMarketDateTimes; } public static SortedList GetCommonMarketDateTimes( ICollection tickers , DateTime firstDateTime , DateTime lastDateTime ) { Hashtable marketDateTimes = getMarketDateTimes( tickers , firstDateTime , lastDateTime ); return getCommonMarketDateTimes( tickers , firstDateTime , lastDateTime , marketDateTimes ); } #endregion /// <summary> /// Gets the ticker whose bars are contained into the bars object /// </summary> /// <returns></returns> public string Ticker { get{ return ((string)this.Rows[ 0 ][ Bars.TickerFieldName ]); } } /// <summary> /// Gets the dateTime of the first bar contained into the Bars object /// </summary> /// <returns></returns> public DateTime StartDateTime { get{ return ((DateTime)this.Rows[ 0 ][ Bars.DateTimeForOpen ]); } } /// <summary> /// Gets the dateTime of the last bar contained into the Bars object /// </summary> /// <returns></returns> public DateTime EndDateTime { get{ return ((DateTime)this.Rows[ this.Rows.Count - 1 ][ Bars.DateTimeForOpen ]); } } #region GetHashValue /* private string getHashValue_getQuoteString_getRowString_getSingleValueString( Object value ) { string returnValue; if ( value.GetType() == Type.GetType( "System.DateTime" ) ) returnValue = ( (DateTime) value ).ToString(); else { if ( value.GetType() == Type.GetType( "System.Double" ) ) returnValue = ( (float) value ).ToString( "F2" ); else returnValue = value.ToString(); } return returnValue + ";"; } /// <summary> /// Computes the string representing the concatenation for a single quote row /// </summary> /// <param name="dataRow"></param> /// <returns></returns> private StringBuilder getHashValue_getQuoteString_getRowString( DataRowView dataRow ) { StringBuilder returnValue = new StringBuilder( "" ); foreach ( DataColumn dataColumn in dataRow.DataView.Table.Columns ) if ( dataColumn.ColumnName != "quTicker" ) returnValue.Append( getHashValue_getQuoteString_getRowString_getSingleValueString( dataRow[ dataColumn.Ordinal ] ) ); // returnValue += "ggg"; // returnValue += getHashValue_getQuoteString_getRowString_getSingleValueString( // dataRow[ dataColumn ] ); return returnValue; } /// <summary> /// Computes the string representing the concatenation of all the quotes /// </summary> /// <param name="ticker"></param> /// <returns></returns> private string getHashValue_getQuoteString( DataView quotes ) { StringBuilder returnValue = new StringBuilder( "" ); foreach ( DataRowView dataRow in quotes ) returnValue.Append( getHashValue_getQuoteString_getRowString( dataRow ) ); return returnValue.ToString(); } /// <summary> /// Computes the hash value for the contained quotes /// </summary> /// <returns>Hash value for all the quotes</returns> public string GetHashValue() { DataView quotes = new DataView( this ); return HashProvider.GetHashValue( getHashValue_getQuoteString( quotes ) ); } /// <summary> /// Computes the hash value for the contained quotes /// since startDate, to endDate /// </summary> /// <param name="startDate">date where hash begins being computed</param> /// <param name="endDate">date where hash ends being computed</param> /// <returns></returns> public string GetHashValue( DateTime startDate , DateTime endDate ) { DataView quotes = new DataView( this ); quotes.RowFilter = "( (quDate>=" + FilterBuilder.GetDateConstant( startDate ) + ") and (quDate<=" + FilterBuilder.GetDateConstant( endDate ) + ") )"; return HashProvider.GetHashValue( getHashValue_getQuoteString( quotes ) ); } */ #endregion private void setHistory() { if ( this.history == null ) // history has not been set, yet { this.history = new History(); this.history.Import( this , Bars.DateTimeForOpen , Bars.Close ); } } /// <summary> /// returns the DateTime for the bar that is precedingMinutes before /// dateTime /// </summary> /// <param name="dateTime"></param> /// <param name="precedingMinutes"></param> /// <returns></returns> public DateTime GetPrecedingDateTime( DateTime dateTime , int precedingMinutes ) { setHistory(); return (DateTime) history.GetKey( Math.Max( 0 , history.IndexOfKeyOrPrevious( dateTime ) - precedingMinutes ) ); } /// <summary> /// returns the DateTime for the bar that is followingMinutes after /// dateTime /// </summary> /// <param name="dateTime"></param> /// <param name="followingMinutes"></param> /// <returns></returns> public DateTime GetFollowingDateTime( DateTime dateTime , int followingMinutes ) { setHistory(); int indexOfKeyOrPrevious = history.IndexOfKeyOrPrevious( dateTime ); DateTime followingDateTime; try { followingDateTime = (DateTime) history.GetKey( Math.Max( 0 , indexOfKeyOrPrevious + followingMinutes ) ); } catch ( ArgumentOutOfRangeException exception ) { string message = exception.Message; throw new Exception( "Quotes.GetFollowingDateTime() error: there is not " + "a dateTime for dateTime=" + dateTime.ToString() + " and followingMinutes=" + followingMinutes ); } return followingDateTime; } /// <summary> /// Returns true if a bar is available at the given dateTime /// </summary> /// <param name="dateTime">dateTime</param> /// <returns></returns> public bool HasDateTime( DateTime dateTime ) { /*alternative code, but primary keys need to be set first bool hasDate; hasDate = this.Rows.Contains(date.Date); return hasDate;*/ setHistory(); return this.history.ContainsKey(dateTime); } /// <summary> /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, /// else it returns the immediate following dateTime at which a bar is available /// </summary> /// <param name="dateTime">dateTime</param> /// <returns></returns> public DateTime GetBarDateTimeOrFollowing( DateTime dateTime ) { if( this.HasDateTime( dateTime ) ) { return dateTime; } else { return GetBarDateTimeOrFollowing( dateTime.AddMinutes( 1 ) ); } } /// <summary> /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, /// else it returns the immediate preceding dateTime at which a bar is available /// </summary> /// <param name="dateTime">dateTime</param> /// <returns></returns> public DateTime GetBarDateTimeOrPreceding( DateTime dateTime ) { if( this.HasDateTime( dateTime ) ) { return dateTime; } else { return GetBarDateTimeOrPreceding( dateTime.AddMinutes( - 1 ) ); } } /// <summary> /// If the ticker has a bar at the given dateTime, then it returns the given dateTime, /// else it returns the first valid following dateTime at which a bar is available /// (or the first valid preceding dateTime, in case dateTime is >= the dateTime of the last available bar) /// </summary> /// <param name="dateTime">dateTime</param> /// <returns></returns> public DateTime GetFirstValidBarDateTime(DateTime dateTime) { DateTime startDateTime = this.StartDateTime; DateTime endDateTime = this.EndDateTime; if( dateTime < startDateTime || (dateTime>=startDateTime && dateTime<=endDateTime)) { return this.GetBarDateTimeOrFollowing(dateTime); } else { return this.GetBarDateTimeOrPreceding(dateTime); } } /// <summary> /// returns the first bar dateTime for the ticker /// </summary> /// <param name="ticker"></param> /// <returns></returns> public static DateTime GetFirstBarDateTime( string ticker ) { return QuantProject.DataAccess.Tables.Bars.GetFirstBarDateTime( ticker ); } /// <summary> /// Gets the close at the given dateTime /// </summary> /// <returns></returns> public float GetClose(DateTime dateTime ) { object[] keys = new object[1]; keys[0] = dateTime.Date; DataRow foundRow = this.Rows.Find(keys); if(foundRow==null) throw new Exception("No bar for such a dateTime!"); return (float)foundRow[ Bars.Close ]; } /// <summary> /// Gets the first valid raw (not adjusted) close at the given date /// </summary> /// <returns></returns> public float GetFirstValidClose(DateTime dateTime ) { object[] keys = new object[1]; keys[0] = this.GetFirstValidBarDateTime(dateTime); DataRow foundRow = this.Rows.Find(keys); if(foundRow==null) throw new Exception("No bar for such a dateTime!"); return (float)foundRow[Bars.Close]; } /// <summary> /// Gets the first valid open at the given dateTime /// </summary> /// <returns></returns> public float GetFirstValidOpen(DateTime dateTime ) { object[] keys = new object[1]; keys[0] = this.GetFirstValidBarDateTime(dateTime); DataRow foundRow = this.Rows.Find(keys); if(foundRow==null) throw new Exception("No bar for such a dateTime!"); return (float)foundRow[Bars.Open]; } } } |
|
From: Marco M. <mi...@us...> - 2008-11-09 19:11:18
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22014/b2_DataAccess/Tables Added Files: Bars.cs Log Message: Added Bars object for accessing database's table bars --- NEW FILE: Bars.cs --- /* QuantDownloader - Quantitative Finance Library Bars.cs Copyright (C) 2008 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using System.Text; using System.Windows.Forms; using QuantProject.ADT; using QuantProject.ADT.Histories; namespace QuantProject.DataAccess.Tables { /// <summary> /// Class to access the Quotes table /// </summary> public class Bars { // these static fields provide field name in the database table // They are intended to be used through intellisense when necessary public static string TickerFieldName = "baTicker"; // Ticker cannot be simply used because public static string Exchange = "baExchange"; public static string DateTimeForOpen = "baDateTimeForOpen"; public static string IntervalFrameInSeconds = "baInterval"; public static string Open = "baOpen"; public static string High = "baHigh"; public static string Low = "baLow"; public static string Close = "baClose"; public static string Volume = "baVolume"; private DataTable bars; /// <summary> /// Gets the ticker whose bars are contained into the Bars object /// </summary> /// <returns></returns> public string Ticker { get{ return ((string)this.bars.Rows[ 0 ][ Bars.TickerFieldName ]); } } public Bars( string ticker) { this.bars = Bars.GetTickerBars( ticker ); } /// <summary> /// Creates bars for the given instrument, since the startDateTime to the endDateTime /// </summary> /// <param name="ticker"></param> /// <param name="startDateTime"></param> /// <param name="endDateTime"></param> public Bars( string ticker , DateTime startDateTime , DateTime endDateTime ) { /// TO DO } /// <summary> /// Returns the dateTime of the first bar for the given ticker /// </summary> /// <param name="ticker">ticker for which the dateTime of the first bar has to be returned</param> /// <returns></returns> public static DateTime GetFirstBarDateTime( string ticker ) { DataTable dataTable = SqlExecutor.GetDataTable( "select min(" + Bars.DateTimeForOpen + ") as minDate from bars where " + Bars.TickerFieldName + "='" + ticker + "' " + "group by " + Bars.TickerFieldName + ")" ); return (DateTime)(dataTable.Rows[ 0 ][ "minDate" ]); } /// <summary> /// Returns the dateTime of the last bar for the given ticker /// </summary> /// <param name="ticker">ticker for which the dateTime of the last bar has to be returned</param> /// <returns></returns> public static DateTime GetLastBarDateTime( string ticker ) { DataTable dataTable = SqlExecutor.GetDataTable( "select * from bars where " + Bars.TickerFieldName + "='" + ticker + "' " + "order by " + Bars.DateTimeForOpen + " DESC"); return (DateTime)(dataTable.Rows[0][ Bars.DateTimeForOpen ]); } /// <summary> /// Returns the number of Bars for the given ticker /// </summary> /// <param name="ticker">ticker for which the number of bars has to be returned</param> /// <returns></returns> public static int GetNumberOfBars( string ticker ) { DataTable dataTable = SqlExecutor.GetDataTable( "select * from bars where " + Bars.TickerFieldName + "='" + ticker + "'" ); return dataTable.Rows.Count; } /// <summary> /// Returns the number of bars at which the given ticker has been effectively traded /// (volume > 0) /// </summary> /// <param name="ticker">ticker for which the number of bars has to be returned</param> /// <returns></returns> public static int GetNumberOfBarsWithEffectiveTrades( string ticker, DateTime firstDateTime, DateTime lastDateTime) { DataTable dataTable = SqlExecutor.GetDataTable( "select * from bars WHERE " + Bars.TickerFieldName + "='" + ticker + "'" + " AND " + Bars.Volume + ">0" + " AND " + Bars.DateTimeForOpen + " BETWEEN " + SQLBuilder.GetDateConstant(firstDateTime) + " AND " + SQLBuilder.GetDateConstant(lastDateTime)); return dataTable.Rows.Count; } /// <summary> /// Returns the close for the given ticker at the specified date /// time /// </summary> /// <param name="ticker">ticker for which the close has to be returned</param> /// <returns></returns> public static float GetClose( string ticker, DateTime dateTime ) { DataTable dataTable = SqlExecutor.GetDataTable( "select " + Bars.Close +" from bars where " + Bars.TickerFieldName + "='" + ticker + "' " + "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateConstant(dateTime) ); return (float)dataTable.Rows[0][0]; } /// <summary> /// Returns the open for the given ticker at the specified date /// time /// </summary> /// <param name="ticker">ticker for which the raw open has to be returned</param> /// <returns></returns> public static float GetOpen( string ticker, DateTime dateTime ) { DataTable dataTable = SqlExecutor.GetDataTable( "select " + Bars.Open +" from bars where " + Bars.TickerFieldName + "='" + ticker + "' " + "and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateConstant(dateTime) ); return (float)dataTable.Rows[0][0]; } // /// <summary> // /// It provides deletion of the quote from the table "quotes" for // /// the given ticker for a specified date // /// </summary> // public static void Delete( string ticker, DateTime dateOfTheQuoteToBeDeleted ) // { // try // { // SqlExecutor.ExecuteNonQuery("DELETE * FROM quotes " + // "WHERE quTicker ='" + // ticker + "' AND quDate =" + // SQLBuilder.GetDateConstant(dateOfTheQuoteToBeDeleted)); // } // catch(Exception ex) // { // string notUsed = ex.ToString(); // } // } // /// <summary> // /// It provides deletion of the quote from the table "quotes" for // /// the given ticker for the specified interval // /// </summary> // public static void Delete( string ticker, DateTime fromDate, // DateTime toDate) // { // try // { // SqlExecutor.ExecuteNonQuery("DELETE * FROM quotes " + // "WHERE quTicker ='" + // ticker + "' AND quDate >=" + // SQLBuilder.GetDateConstant(fromDate) + " " + // "AND quDate<=" + SQLBuilder.GetDateConstant(toDate)); // } // catch(Exception ex) // { // string notUsed = ex.ToString(); // } // } // /// <summary> // /// It provides addition of the given quote's values into table "quotes" // /// </summary> // public static void Add( string ticker, DateTime date, double open, // double high, double low, double close, // double volume, double adjustedClose) // { // try // { // SqlExecutor.ExecuteNonQuery("INSERT INTO quotes(quTicker, quDate, quOpen, " + // "quHigh, quLow, quClose, quVolume, quAdjustedClose) " + // "VALUES('" + ticker + "', " + SQLBuilder.GetDateConstant(date) + ", " + // open + ", " + high + ", " + low + ", " + close + ", " + // volume + ", " + adjustedClose + ")"); // } // catch(Exception ex) // { // string notUsed = ex.ToString(); // } // } /// <summary> /// returns tickers ordered by a liquidity index /// </summary> public static DataTable GetTickersByLiquidity( bool orderInASCMode, string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, long maxNumOfReturnedTickers) { string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + "Avg([quVolume]*[quClose]) AS AverageTradedValue " + "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + "ORDER BY Avg([quVolume]*[quClose])"; string sortDirection = " DESC"; if(orderInASCMode) sortDirection = " ASC"; sql = sql + sortDirection; return SqlExecutor.GetDataTable( sql ); } // /// <summary> // /// returns tickers ordered by liquidity, with a specified min volume // /// </summary> // /// <param name="orderInASCMode">true iff return must be ordered</param> // /// <param name="groupID"></param> // /// <param name="firstQuoteDate"></param> // /// <param name="lastQuoteDate"></param> // /// <param name="maxNumOfReturnedTickers"></param> // /// <param name="minVolume"></param> // /// <returns></returns> // public static DataTable GetTickersByLiquidity( bool orderInASCMode, string groupID, // DateTime firstQuoteDate, // DateTime lastQuoteDate, // long minVolume, // long maxNumOfReturnedTickers // ) // { // string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + // "Avg([quVolume]*[quClose]) AS AverageTradedValue " + // "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + // "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + // "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + // "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + // "AND quotes.quDate BETWEEN " + // SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + // SQLBuilder.GetDateConstant(lastQuoteDate) + // "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + // "HAVING Avg([quVolume])>=" + minVolume.ToString() + " " + // "ORDER BY Avg([quVolume])"; // string sortDirection = " DESC"; // if(orderInASCMode) // sortDirection = " ASC"; // sql = sql + sortDirection; // return SqlExecutor.GetDataTable( sql ); // } // // // // /// <summary> // /// Returns tickers ordered by a close to close volatility index (stdDev of adjustedCloseToClose ratio) // /// </summary> // public static DataTable GetTickersByCloseToCloseVolatility( bool orderInASCMode, string groupID, // DateTime firstQuoteDate, // DateTime lastQuoteDate, // long maxNumOfReturnedTickers) // { // string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + // "StDev(quotes.quAdjustedCloseToCloseRatio) AS AdjCloseToCloseStandDev " + // "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + // "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + // "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + // "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + // "AND quotes.quDate BETWEEN " + // SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + // SQLBuilder.GetDateConstant(lastQuoteDate) + // "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + // "ORDER BY StDev(quotes.quAdjustedCloseToCloseRatio)"; // string sortDirection = " DESC"; // if(orderInASCMode) // sortDirection = " ASC"; // sql = sql + sortDirection; // return SqlExecutor.GetDataTable( sql ); // } // // /// <summary> // /// Returns tickers ordered by the open to close volatility index (stdDev of OTC ratio) // /// </summary> // public static DataTable GetTickersByOpenToCloseVolatility( bool orderInASCMode, string groupID, // DateTime firstQuoteDate, // DateTime lastQuoteDate, // long maxNumOfReturnedTickers) // { // string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + // "StDev(quotes.quClose/quotes.quOpen - 1) AS OpenToCloseStandDev " + // "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + // "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + // "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + // "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + // "AND quotes.quDate BETWEEN " + // SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + // SQLBuilder.GetDateConstant(lastQuoteDate) + // "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + // "ORDER BY StDev(quotes.quClose/quotes.quOpen - 1)"; // string sortDirection = " DESC"; // if(orderInASCMode) // sortDirection = " ASC"; // sql = sql + sortDirection; // return SqlExecutor.GetDataTable( sql ); // } // // /// <summary> // /// Returns tickers ordered by average close to close performance // /// </summary> // public static DataTable GetTickersByAverageCloseToClosePerformance( bool orderInASCMode, string groupID, // DateTime firstQuoteDate, // DateTime lastQuoteDate, // long maxNumOfReturnedTickers) // { // string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + // "Avg(quotes.quAdjustedCloseToCloseRatio) AS AverageCloseToClosePerformance " + // "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + // "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + // "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + // "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + // "AND quotes.quDate BETWEEN " + // SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + // SQLBuilder.GetDateConstant(lastQuoteDate) + // "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + // "ORDER BY Avg(quotes.quAdjustedCloseToCloseRatio)"; // string sortDirection = " DESC"; // if(orderInASCMode) // sortDirection = " ASC"; // sql = sql + sortDirection; // return SqlExecutor.GetDataTable( sql ); // } // // /// <summary> // /// Returns tickers ordered by average open to close performance (in the same bar) // /// </summary> // public static DataTable GetTickersByAverageOpenToClosePerformance( bool orderInASCMode, string groupID, // DateTime firstQuoteDate, // DateTime lastQuoteDate, // double maxAbsoluteAverageOTCPerformance, // long maxNumOfReturnedTickers) // { // string sql = "SELECT TOP " + maxNumOfReturnedTickers + " tickers.tiTicker, tickers.tiCompanyName, " + // "Avg(quotes.quClose/quotes.quOpen - 1) AS AverageOpenToClosePerformance " + // "FROM quotes INNER JOIN (tickers INNER JOIN tickers_tickerGroups " + // "ON tickers.tiTicker = tickers_tickerGroups.ttTiId) " + // "ON quotes.quTicker = tickers_tickerGroups.ttTiId " + // "WHERE tickers_tickerGroups.ttTgId='" + groupID + "' " + // "AND quotes.quDate BETWEEN " + // SQLBuilder.GetDateConstant(firstQuoteDate) + " AND " + // SQLBuilder.GetDateConstant(lastQuoteDate) + // "GROUP BY tickers.tiTicker, tickers.tiCompanyName " + // "HAVING Avg(quotes.quClose/quotes.quOpen - 1) <= " + maxAbsoluteAverageOTCPerformance + // " AND Avg(quotes.quClose/quotes.quOpen - 1) >= -" + maxAbsoluteAverageOTCPerformance + " " + // "ORDER BY Avg(quotes.quClose/quotes.quOpen)"; // string sortDirection = " DESC"; // if(orderInASCMode) // sortDirection = " ASC"; // sql = sql + sortDirection; // return SqlExecutor.GetDataTable( sql ); // } // // /// <summary> // /// returns tickers ordered by the average raw open price that is over // /// a given minimum, at a given time interval // /// </summary> // public static DataTable GetTickersByRawOpenPrice( bool orderInASCMode, string groupID, // DateTime firstQuoteDate, // DateTime lastQuoteDate, // long maxNumOfReturnedTickers, double minPrice ) // { // string sql = "SELECT TOP " + maxNumOfReturnedTickers + " quotes.quTicker, tickers.tiCompanyName, " + // "Avg(quotes.quOpen) AS AverageRawOpenPrice " + // "FROM (quotes INNER JOIN tickers ON quotes.quTicker=tickers.tiTicker) " + // "INNER JOIN tickers_tickerGroups ON tickers.tiTicker=tickers_tickerGroups.ttTiId " + // "WHERE quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + // "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + // "AND " + "tickers_tickerGroups.ttTgId='" + groupID + "' " + // "GROUP BY quotes.quTicker, tickers.tiCompanyName " + // "HAVING Avg(quotes.quOpen) >= " + minPrice + " " + // "ORDER BY Avg(quotes.quOpen)"; // string sortDirection = " DESC"; // if(orderInASCMode) // sortDirection = " ASC"; // sql = sql + sortDirection; // return SqlExecutor.GetDataTable( sql ); // } // // /// <summary> // /// returns tickers ordered by average raw open price level, // /// with a given standard deviation, in a given time interval // /// </summary> // public static DataTable GetTickersByRawOpenPrice( bool orderInASCMode, string groupID, // DateTime firstQuoteDate, // DateTime lastQuoteDate, // long maxNumOfReturnedTickers, double minPrice, // double maxPrice, double minStdDeviation, // double maxStdDeviation) // { // string sql = "SELECT TOP " + maxNumOfReturnedTickers + " quotes.quTicker, tickers.tiCompanyName, " + // "Avg(quotes.quOpen) AS AverageRawOpenPrice, StDev(quotes.quOpen) AS StdDevRawOpenPrice " + // "FROM (quotes INNER JOIN tickers ON quotes.quTicker=tickers.tiTicker) " + // "INNER JOIN tickers_tickerGroups ON tickers.tiTicker=tickers_tickerGroups.ttTiId " + // "WHERE quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + // "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + // "AND " + "tickers_tickerGroups.ttTgId='" + groupID + "' " + // "GROUP BY quotes.quTicker, tickers.tiCompanyName " + // "HAVING Avg(quotes.quOpen) BETWEEN " + minPrice + " AND " + maxPrice + " " + // "AND StDev(quotes.quOpen) BETWEEN " + minStdDeviation + " AND " + maxStdDeviation + " " + // "ORDER BY Avg(quotes.quOpen)"; // string sortDirection = " DESC"; // if(orderInASCMode) // sortDirection = " ASC"; // sql = sql + sortDirection; // return SqlExecutor.GetDataTable( sql ); // } // /// <summary> // /// returns the average traded value for the given ticker in the specified interval // /// </summary> // public static double GetAverageTradedValue( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // DataTable dt; // string sql = "SELECT quotes.quTicker, " + // "Avg([quVolume]*[quClose]) AS AverageTradedValue " + // "FROM quotes WHERE quTicker ='" + // ticker + "' " + // "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + // " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + // " GROUP BY quotes.quTicker"; // dt = SqlExecutor.GetDataTable( sql ); // if(dt.Rows.Count==0) // return 0; // else // return (double)dt.Rows[0]["AverageTradedValue"]; // } // // /// <summary> // /// returns the average traded volume for the given ticker in the specified interval // /// </summary> // public static double GetAverageTradedVolume( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // DataTable dt; // string sql = "SELECT quotes.quTicker, " + // "Avg([quVolume]) AS AverageTradedVolume " + // "FROM quotes WHERE quTicker ='" + // ticker + "' " + // "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + // " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + // " GROUP BY quotes.quTicker"; // dt = SqlExecutor.GetDataTable( sql ); // if(dt.Rows.Count==0) // return 0; // else // return (double)dt.Rows[0]["AverageTradedVolume"]; // } // // /// <summary> // /// returns the average close to close performance value for the given ticker in the specified interval // /// </summary> // public static double GetAverageCloseToClosePerformance( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // DataTable dt; // string sql = "SELECT quotes.quTicker, " + // "Avg([quAdjustedCloseToCloseRatio]) AS AverageCloseToClosePerformance " + // "FROM quotes WHERE quTicker ='" + // ticker + "' " + // "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + // " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + // " GROUP BY quotes.quTicker"; // dt = SqlExecutor.GetDataTable( sql ); // if(dt.Rows.Count==0) // return 0; // else // return (double)dt.Rows[0]["AverageCloseToClosePerformance"]; // } // // /// <summary> // /// returns the average open to close performance // /// for the given ticker in the specified interval // /// </summary> // public static double GetAverageOpenToClosePerformance(string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // DataTable dt; // string sql = "SELECT quotes.quTicker, " + // "Avg([quClose]/[quOpen] - 1) AS AverageOpenToClosePerformance " + // "FROM quotes WHERE quTicker ='" + // ticker + "' " + // "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + // " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + // " GROUP BY quotes.quTicker"; // dt = SqlExecutor.GetDataTable( sql ); // return (double)dt.Rows[0]["AverageOpenToClosePerformance"]; // } // // // /// <summary> // /// returns the standard deviation of the adjusted close to close ratio // /// for the given ticker in the specified interval // /// </summary> // public static double GetAdjustedCloseToCloseStandardDeviation( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // double adjCloseToCloseStdDev = 0.0; // DataTable dt; // string sql = "SELECT quotes.quTicker, " + // "StDev(quotes.quAdjustedCloseToCloseRatio) AS AdjCloseToCloseStandDev " + // "FROM quotes WHERE quTicker ='" + // ticker + "' " + // "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + // " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + // " GROUP BY quotes.quTicker"; // dt = SqlExecutor.GetDataTable( sql ); // // if( dt.Rows.Count > 0 && // DBNull.Value != dt.Rows[0]["AdjCloseToCloseStandDev"] ) // adjCloseToCloseStdDev = (double)dt.Rows[0]["AdjCloseToCloseStandDev"]; // // return adjCloseToCloseStdDev; // } // // /// <summary> // /// returns the standard deviation of the open to close ratio // /// for the given ticker in the specified interval // /// </summary> // public static double GetOpenToCloseStandardDeviation( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // DataTable dt; // string sql = "SELECT quotes.quTicker, " + // "StDev(quotes.quClose/quotes.quOpen - 1) AS OpenToCloseStandDev " + // "FROM quotes WHERE quTicker ='" + // ticker + "' " + // "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + // " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + // " GROUP BY quotes.quTicker"; // dt = SqlExecutor.GetDataTable( sql ); // return (double)dt.Rows[0]["OpenToCloseStandDev"]; // } // // /// <summary> // /// returns the standard deviation of the adjusted close to open ratio // /// for the given ticker in the specified interval // /// </summary> // public static double GetCloseToOpenStandardDeviation( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // double returnValue = Double.MaxValue; // // DataTable dt; // string sql = "SELECT quotes.quTicker, " + // "StDev(quotes.quClose/quotes.quOpen) AS CloseToOpenStandDev " + // "FROM quotes WHERE quTicker ='" + // ticker + "' " + // "AND quotes.quDate BETWEEN " + SQLBuilder.GetDateConstant(firstQuoteDate) + // " AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + // " GROUP BY quotes.quTicker"; // dt = SqlExecutor.GetDataTable( sql ); // if(dt.Rows.Count > 0) // { // if( dt.Rows[0]["CloseToOpenStandDev"] is double ) // //cast is possible // returnValue = (double)dt.Rows[0]["CloseToOpenStandDev"]; // } // return returnValue; // } // // /// <summary> // /// returns the average raw open price for the given ticker, // /// at the specified time interval // /// </summary> // public static double GetAverageRawOpenPrice( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // double returnValue = 0; // DataTable dt; // string sql = "SELECT quotes.quTicker, tickers.tiCompanyName, " + // "Avg(quotes.quOpen) AS AverageRawOpenPrice " + // "FROM (quotes INNER JOIN tickers ON quotes.quTicker=tickers.tiTicker) " + // "INNER JOIN tickers_tickerGroups ON tickers.tiTicker=tickers_tickerGroups.ttTiId " + // "WHERE quotes.quTicker ='" + ticker + // "' AND quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + // "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + // "GROUP BY quotes.quTicker, tickers.tiCompanyName"; // dt = SqlExecutor.GetDataTable( sql ); // if(dt.Rows.Count > 0) // { // if( dt.Rows[0]["AverageRawOpenPrice"] is double ) // //cast is possible // returnValue = (double)dt.Rows[0]["AverageRawOpenPrice"]; // } // return returnValue; // // } // // /// <summary> // /// returns raw open price's standard deviation for the given ticker, // /// at the specified time interval // /// </summary> // public static double GetRawOpenPriceStdDeviation( string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // // { // double returnValue = Double.MaxValue; // DataTable dt; // string sql = "SELECT quotes.quTicker, tickers.tiCompanyName, " + // "StDev(quotes.quOpen) AS RawOpenPriceStdDev " + // "FROM (quotes INNER JOIN tickers ON quotes.quTicker=tickers.tiTicker) " + // "INNER JOIN tickers_tickerGroups ON tickers.tiTicker=tickers_tickerGroups.ttTiId " + // "WHERE quotes.quTicker ='" + ticker + // "' AND quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + // "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + // "GROUP BY quotes.quTicker, tickers.tiCompanyName"; // dt = SqlExecutor.GetDataTable( sql ); // if(dt.Rows.Count > 0) // { // if( dt.Rows[0]["RawOpenPriceStdDev"] is double ) // //cast is possible // returnValue = (double)dt.Rows[0]["RawOpenPriceStdDev"]; // } // return returnValue; // } // // /// <summary> // /// Returns number of days for which raw close was greater than raw open // /// for the given interval of days (for the given ticker). // /// </summary> // public static int GetNumberOfOpenToCloseWinningDays(string ticker, // DateTime firstQuoteDate, // DateTime lastQuoteDate) // { // DataTable dt; // int returnValue = 0; // string sql = "SELECT Count(*) AS CloseToOpenWinningDays " + // "FROM quotes WHERE " + // "quotes.quDate Between " + SQLBuilder.GetDateConstant(firstQuoteDate) + " " + // "AND " + SQLBuilder.GetDateConstant(lastQuoteDate) + " " + // "AND " + "quotes.quTicker='" + ticker + "' " + // "AND quotes.quClose > quotes.quOpen"; // // dt = SqlExecutor.GetDataTable( sql ); // if(dt.Rows.Count > 0) // { // if(dt.Rows[0][0] is int) // returnValue = (int)dt.Rows[0][0]; // } // return returnValue; // } /// <summary> /// returns the bars DataTable for the given ticker /// </summary> /// <param name="instrumentKey">ticker whose bars are to be returned</param> /// <returns></returns> public static DataTable GetTickerBars( string instrumentKey ) { string sql = "select * from bars where " + Bars.TickerFieldName + "='" + instrumentKey + "' " + "order by " + Bars.DateTimeForOpen; return SqlExecutor.GetDataTable( sql ); } /// <summary> /// returns the bars DataTable for the given ticker /// </summary> /// <param name="instrumentKey">ticker whose quotes are to be returned</param> /// <param name="firstBarDateTime">The first bar date time</param> /// <param name="lastBarDateTime">The last bar date time</param> /// <returns></returns> public static DataTable GetTickerBars( string instrumentKey, DateTime firstBarDateTime, DateTime lastBarDateTime) { string sql = "select * from bars where " + Bars.TickerFieldName + "='" + instrumentKey + "' " + "AND " + Bars.DateTimeForOpen + " BETWEEN " + SQLBuilder.GetDateConstant(firstBarDateTime) + " AND " + SQLBuilder.GetDateConstant(lastBarDateTime) + " " + "order by " + Bars.DateTimeForOpen; return SqlExecutor.GetDataTable( sql ); } /// <summary> /// Returns the bars for the given instrument , since startDateTime to endDateTime /// </summary> /// <param name="tickerOrGroupID">The symbol of a ticker or the groupID corresponding to a specific set of tickers</param> /// <param name="startDateTime"></param> /// <param name="endDateTime"></param> /// <returns></returns> public static void SetDataTable( string tickerOrGroupID , DateTime startDateTime , DateTime endDateTime , DataTable dataTable) { string sql; if(Tickers_tickerGroups.HasTickers(tickerOrGroupID)) sql = "select * from bars INNER JOIN tickers_tickerGroups ON " + "bars." + Bars.TickerFieldName + "=tickers_tickerGroups." + Tickers_tickerGroups.Ticker + " " + "where " + Tickers_tickerGroups.GroupID + "='" + tickerOrGroupID + "' " + "and " + Bars.DateTimeForOpen + ">=" + SQLBuilder.GetDateTimeConstant( startDateTime ) + " " + "and " + Bars.DateTimeForOpen + "<=" + SQLBuilder.GetDateTimeConstant( endDateTime ) + " " + "order by " + Bars.DateTimeForOpen; else sql = "select * from bars " + "where " + Bars.TickerFieldName + "='" + tickerOrGroupID + "' " + "and " + Bars.DateTimeForOpen + ">=" + SQLBuilder.GetDateTimeConstant( startDateTime ) + " " + "and " + Bars.DateTimeForOpen + "<=" + SQLBuilder.GetDateTimeConstant( endDateTime ) + " " + "order by " + Bars.DateTimeForOpen; SqlExecutor.SetDataTable( sql , dataTable ); } #region SetDataTable for tickerList private static string setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( string ticker ) { return "(" + Bars.TickerFieldName + "='" + ticker + "')"; } private static string setDataTable_getTickerListWhereClause( ICollection tickerCollection ) { string returnValue = ""; foreach (string ticker in tickerCollection) if ( returnValue == "" ) // this is the first ticker to handle returnValue += setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( ticker ); else // this is not the first ticker to handle returnValue += " or " + setDataTable_getTickerListWhereClause_getSingleTickerWhereClause( ticker ); return "( " + returnValue + " )"; } /// <summary> /// Builds a Bars data table containing a row for each ticker in the /// collection, with the bars for the given DateTime /// </summary> /// <param name="tickerCollection">Tickers whose quotes are to be fetched</param> /// <param name="dateTime">Date for the quotes to be fetched</param> /// <param name="dataTable">Output parameter</param> public static void SetDataTable( ICollection tickerCollection , DateTime dateTime , DataTable dataTable) { string sql; sql = "select * from bars " + "where " + setDataTable_getTickerListWhereClause( tickerCollection ) + " and " + Bars.DateTimeForOpen + "=" + SQLBuilder.GetDateTimeConstant( dateTime ) + " " + "order by " + Bars.TickerFieldName; SqlExecutor.SetDataTable( sql , dataTable ); } #endregion } } |
|
From: Marco M. <mi...@us...> - 2008-11-09 16:36:29
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10013/b4_Business/a2_Strategies/returnsManagement/time Modified Files: CloseToCloseIntervals.cs CloseToOpenIntervals.cs DailyOpenToCloseIntervals.cs OpenToCloseCloseToOpenIntervals.cs OpenToOpenIntervals.cs Log Message: Added Serializable attribute Index: CloseToOpenIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/CloseToOpenIntervals.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CloseToOpenIntervals.cs 29 Sep 2008 21:15:13 -0000 1.3 --- CloseToOpenIntervals.cs 9 Nov 2008 16:36:21 -0000 1.4 *************** *** 30,33 **** --- 30,34 ---- /// Close to Open intervals to be used to compute close to open returns /// </summary> + [Serializable] public class CloseToOpenIntervals : ReturnIntervals { Index: CloseToCloseIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/CloseToCloseIntervals.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CloseToCloseIntervals.cs 29 Sep 2008 21:15:13 -0000 1.5 --- CloseToCloseIntervals.cs 9 Nov 2008 16:36:21 -0000 1.6 *************** *** 30,33 **** --- 30,34 ---- /// Close to close intervals to be used to compute close to close returns /// </summary> + [Serializable] public class CloseToCloseIntervals : ReturnIntervals { Index: OpenToCloseCloseToOpenIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/OpenToCloseCloseToOpenIntervals.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OpenToCloseCloseToOpenIntervals.cs 29 Sep 2008 21:17:13 -0000 1.3 --- OpenToCloseCloseToOpenIntervals.cs 9 Nov 2008 16:36:21 -0000 1.4 *************** *** 33,36 **** --- 33,37 ---- /// by the next open to close return, and so on /// </summary> + [Serializable] public class OpenToCloseCloseToOpenIntervals : ReturnIntervals { *************** *** 65,69 **** (DateTime)this.marketDaysForBenchmark.GetKey( i + 1 ); ReturnInterval returnCTOInterval = new ReturnInterval( ! HistoricalEndOfDayTimer.GetMarketClose( dateTimeForCTOEnd ) , HistoricalEndOfDayTimer.GetMarketOpen( dateTimeForCTOEnd ) ); // new EndOfDayDateTime( dateTimeForOTC , --- 66,70 ---- (DateTime)this.marketDaysForBenchmark.GetKey( i + 1 ); ReturnInterval returnCTOInterval = new ReturnInterval( ! HistoricalEndOfDayTimer.GetMarketClose( dateTimeForOTC ) , HistoricalEndOfDayTimer.GetMarketOpen( dateTimeForCTOEnd ) ); // new EndOfDayDateTime( dateTimeForOTC , Index: DailyOpenToCloseIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/DailyOpenToCloseIntervals.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DailyOpenToCloseIntervals.cs 29 Sep 2008 21:15:14 -0000 1.4 --- DailyOpenToCloseIntervals.cs 9 Nov 2008 16:36:21 -0000 1.5 *************** *** 30,33 **** --- 30,34 ---- /// Open to close intervals to be used to compute open to close returns /// </summary> + [Serializable] public class DailyOpenToCloseIntervals : ReturnIntervals { Index: OpenToOpenIntervals.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time/OpenToOpenIntervals.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OpenToOpenIntervals.cs 29 Sep 2008 21:17:13 -0000 1.2 --- OpenToOpenIntervals.cs 9 Nov 2008 16:36:21 -0000 1.3 *************** *** 30,33 **** --- 30,34 ---- /// Open to Open intervals to be used to compute open to open returns /// </summary> + [Serializable] public class OpenToOpenIntervals : ReturnIntervals { |
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10013/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers Modified Files: PVO_CTCCorrelationChooser.cs PVO_CTCStrongCorrelationChooser.cs PVO_CTOCorrelationChooser.cs PVO_OTCCorrelationChooser.cs PVO_OTCCTOCorrelationChooser.cs PVO_OTOCorrelationChooser.cs PVOChooserFromSavedBackTestLog.cs PVOCorrelationChooser.cs PVOGeneticChooser.cs Log Message: Added Serializable attribute Index: PVO_CTCStrongCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_CTCStrongCorrelationChooser.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVO_CTCStrongCorrelationChooser.cs 29 Sep 2008 21:18:49 -0000 1.2 --- PVO_CTCStrongCorrelationChooser.cs 9 Nov 2008 16:36:21 -0000 1.3 *************** *** 42,45 **** --- 42,46 ---- /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> + [Serializable] public class PVO_CTCStrongCorrelationChooser : IInSampleChooser { Index: PVO_CTCCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_CTCCorrelationChooser.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PVO_CTCCorrelationChooser.cs 29 Sep 2008 21:18:49 -0000 1.5 --- PVO_CTCCorrelationChooser.cs 9 Nov 2008 16:36:21 -0000 1.6 *************** *** 42,45 **** --- 42,46 ---- /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> + [Serializable] public class PVO_CTCCorrelationChooser : PVOCorrelationChooser { Index: PVO_OTCCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_OTCCorrelationChooser.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PVO_OTCCorrelationChooser.cs 14 Aug 2008 23:28:06 -0000 1.4 --- PVO_OTCCorrelationChooser.cs 9 Nov 2008 16:36:21 -0000 1.5 *************** *** 42,45 **** --- 42,46 ---- /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> + [Serializable] public class PVO_OTCCorrelationChooser : PVOCorrelationChooser { Index: PVOGeneticChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVOGeneticChooser.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVOGeneticChooser.cs 29 Sep 2008 21:19:05 -0000 1.2 --- PVOGeneticChooser.cs 9 Nov 2008 16:36:21 -0000 1.3 *************** *** 40,43 **** --- 40,44 ---- /// In sample genetic analyzer for the Portfolio Value Oscillator /// </summary> + [Serializable] public class PVOGeneticChooser : GeneticChooser { Index: PVO_OTCCTOCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_OTCCTOCorrelationChooser.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVO_OTCCTOCorrelationChooser.cs 14 Aug 2008 23:28:06 -0000 1.2 --- PVO_OTCCTOCorrelationChooser.cs 9 Nov 2008 16:36:21 -0000 1.3 *************** *** 42,45 **** --- 42,46 ---- /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> + [Serializable] public class PVO_OTCCTOCorrelationChooser : PVOCorrelationChooser { Index: PVO_OTOCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_OTOCorrelationChooser.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PVO_OTOCorrelationChooser.cs 29 Sep 2008 21:18:49 -0000 1.2 --- PVO_OTOCorrelationChooser.cs 9 Nov 2008 16:36:21 -0000 1.3 *************** *** 43,46 **** --- 43,47 ---- /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> + [Serializable] public class PVO_OTOCorrelationChooser : PVOCorrelationChooser { Index: PVOChooserFromSavedBackTestLog.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVOChooserFromSavedBackTestLog.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVOChooserFromSavedBackTestLog.cs 29 Sep 2008 21:19:05 -0000 1.3 --- PVOChooserFromSavedBackTestLog.cs 9 Nov 2008 16:36:21 -0000 1.4 *************** *** 35,39 **** /// already saved in a BackTestLog saved to disk /// </summary> ! public class PVOChooserFromSavedBackTestLog : BasicChooserFromSavedBackTestLog { --- 35,40 ---- /// already saved in a BackTestLog saved to disk /// </summary> ! [Serializable] ! public class PVOChooserFromSavedBackTestLog : BasicChooserFromSavedBackTestLog { Index: PVO_CTOCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVO_CTOCorrelationChooser.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVO_CTOCorrelationChooser.cs 14 Aug 2008 23:43:18 -0000 1.1 --- PVO_CTOCorrelationChooser.cs 9 Nov 2008 16:36:21 -0000 1.2 *************** *** 42,45 **** --- 42,46 ---- /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> + [Serializable] public class PVO_CTOCorrelationChooser : PVOCorrelationChooser { Index: PVOCorrelationChooser.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers/PVOCorrelationChooser.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PVOCorrelationChooser.cs 14 Aug 2008 23:28:06 -0000 1.6 --- PVOCorrelationChooser.cs 9 Nov 2008 16:36:21 -0000 1.7 *************** *** 42,45 **** --- 42,46 ---- /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> + [Serializable] public abstract class PVOCorrelationChooser : IInSampleChooser { |
|
From: Marco M. <mi...@us...> - 2008-11-09 16:36:29
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10013/b4_Business/a2_Strategies/EndOfDayStrategies Modified Files: EndOfDayTimerHandler.cs Log Message: Added Serializable attribute Index: EndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/EndOfDayStrategies/EndOfDayTimerHandler.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayTimerHandler.cs 29 Sep 2008 21:02:49 -0000 1.1 --- EndOfDayTimerHandler.cs 9 Nov 2008 16:36:21 -0000 1.2 *************** *** 30,33 **** --- 30,34 ---- /// Abstract class to be extended by end of day timer handlers /// </summary> + [Serializable] public abstract class EndOfDayTimerHandler { |
|
From: Marco M. <mi...@us...> - 2008-11-09 16:36:29
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10013/b4_Business/a2_Strategies/TickersRelationships Modified Files: CorrelationProvider.cs Log Message: Added Serializable attribute Index: CorrelationProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CorrelationProvider.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CorrelationProvider.cs 29 Sep 2008 21:15:12 -0000 1.6 --- CorrelationProvider.cs 9 Nov 2008 16:36:21 -0000 1.7 *************** *** 212,216 **** if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); ! this.showOutputToConsole(); return this.pearsonCorrelations; } --- 212,216 ---- if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); ! //this.showOutputToConsole(); return this.pearsonCorrelations; } |