quantproject-developers Mailing List for QuantProject (Page 18)
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...> - 2009-03-29 18:04:48
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv885/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVOStrategyIntradayMain.cs Log Message: A couple of useless lines have been commented out, to avoid warning messages Index: PVOStrategyIntradayMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOStrategyIntradayMain.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PVOStrategyIntradayMain.cs 13 Mar 2009 15:12:01 -0000 1.4 --- PVOStrategyIntradayMain.cs 29 Mar 2009 18:04:32 -0000 1.5 *************** *** 125,130 **** double maxPrice = 300; ! int maxNumberOfMostLiquidTickersToBeChosen = 150; ! int numDaysForVolatility = 10; int minimumNumberOfMinutelyBarsForEachDayForInSample = 20; --- 125,130 ---- double maxPrice = 300; ! // int maxNumberOfMostLiquidTickersToBeChosen = 150; ! // int numDaysForVolatility = 10; int minimumNumberOfMinutelyBarsForEachDayForInSample = 20; |
|
From: Marco M. <mi...@us...> - 2009-03-21 09:56:29
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23444/b4_Business Modified Files: Business_SD.csproj Log Message: Added new summary row AveragePermanenceTimeOnTheMarket, which computes the average time in minutes positions stay on the market. Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Business_SD.csproj 13 Mar 2009 15:19:10 -0000 1.37 --- Business_SD.csproj 21 Mar 2009 09:56:21 -0000 1.38 *************** *** 69,72 **** --- 69,73 ---- <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\StatisticsSummaryRows\AverageReturnOnWednesdayWithOpenPositions.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AverageNumberOfTransactionsPerDay.cs" /> + <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\SummaryRows\AveragePermanenceTimeOnTheMarket.cs" /> <Compile Include="a1_Financial\a2_Accounting\h5_Reporting\Tables\StatisticsSummary.cs" /> <Compile Include="a1_Financial\a2_Accounting\Transactions\TimedTransaction.cs" /> |
|
From: Marco M. <mi...@us...> - 2009-03-21 09:55:44
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23151/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Modified Files: Summary.cs Log Message: Added new summary row AveragePermanenceTimeOnTheMarket, which computes the average time in minutes positions stay on the market. Index: Summary.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Summary.cs 20 Nov 2008 20:52:28 -0000 1.23 --- Summary.cs 21 Mar 2009 09:55:33 -0000 1.24 *************** *** 48,51 **** --- 48,52 ---- private PercentageWinningPeriods percentageWinningPeriods; private AverageNumberOfTransactionsPerDay averageNumberOfTransactionsPerDay; + private AveragePermanenceTimeOnTheMarket averagePermanenceTimeOnTheMarket; public AccountReport AccountReport *************** *** 172,176 **** get { return this.averageNumberOfTransactionsPerDay; } } ! private void summary( AccountReport accountReport ) --- 173,180 ---- get { return this.averageNumberOfTransactionsPerDay; } } ! public AveragePermanenceTimeOnTheMarket AveragePermanenceTimeOnTheMarket ! { ! get { return this.averagePermanenceTimeOnTheMarket; } ! } private void summary( AccountReport accountReport ) *************** *** 290,293 **** --- 294,298 ---- this.totalCommissionAmount = new TotalCommissionAmount( this ); this.averageNumberOfTransactionsPerDay = new AverageNumberOfTransactionsPerDay(this); + this.averagePermanenceTimeOnTheMarket = new AveragePermanenceTimeOnTheMarket(this); //this.DataTable = getSummaryDataTable(); } |
|
From: Marco M. <mi...@us...> - 2009-03-21 09:55:19
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23044/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Added Files: AveragePermanenceTimeOnTheMarket.cs Log Message: Added new summary row AveragePermanenceTimeOnTheMarket, which computes the average time in minutes positions stay on the market. --- NEW FILE: AveragePermanenceTimeOnTheMarket.cs --- /* QuantProject - Quantitative Finance Library AveragePermanenceTimeOnTheMarket.cs Copyright (C) 2009 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using System.Data; using QuantProject.Data.DataTables; using QuantProject.Business.Financial.Accounting.Reporting.Tables; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// Summary row containing the average permanence time in minutes /// on the market in the backtest's period for /// the account report equity line /// </summary> [Serializable] public class AveragePermanenceTimeOnTheMarket : DoubleSummaryRow { private DataTable transactions; private string fieldNameForTicker; private string fieldNameForDateTime; private string fieldNameForTransactionType; private double getMinutesForCurrentRoundTrade( int rowIndex ) { DateTime startDateTimeOfTrade = (DateTime)this.transactions.Rows[ rowIndex ][fieldNameForDateTime]; DateTime endDateTimeOfTrade = new DateTime(1900,1,1); string currentTicker = (string)this.transactions.Rows[ rowIndex ][fieldNameForTicker]; string currentTradeType = (string)this.transactions.Rows[ rowIndex ][fieldNameForTransactionType]; for (int j = rowIndex + 1; j < this.transactions.Rows.Count ; j++) { if( currentTicker == (string)this.transactions.Rows[ j ][fieldNameForTicker] && ((currentTradeType == "BuyLong" && (string)this.transactions.Rows[ j ][fieldNameForTransactionType] == "Sell") || (currentTradeType == "SellShort" && (string)this.transactions.Rows[ j ][fieldNameForTransactionType] == "Cover") ) ) { endDateTimeOfTrade = (DateTime)this.transactions.Rows[ j ][fieldNameForDateTime]; j = this.transactions.Rows.Count; } } TimeSpan timeSpanBetweenEnterAndExit = endDateTimeOfTrade.Subtract(startDateTimeOfTrade); return timeSpanBetweenEnterAndExit.TotalMinutes; } private bool doesCurrentRowIndexPointToABuyLongOrASellShort( int rowIndex ) { bool returnValue; string currentTransactionType = (string)this.transactions.Rows[ rowIndex ][fieldNameForTransactionType]; returnValue = ( currentTransactionType == "BuyLong" || currentTransactionType == "SellShort" ); return returnValue; } private void setFieldNames() { this.fieldNameForTicker = QuantProject.Business.Financial.Accounting.Reporting.Tables.Transactions.FieldNameForTicker; this.fieldNameForDateTime = QuantProject.Business.Financial.Accounting.Reporting.Tables.Transactions.FieldNameForDateTime; this.fieldNameForTransactionType = QuantProject.Business.Financial.Accounting.Reporting.Tables.Transactions.FieldNameForTransactionType; } public AveragePermanenceTimeOnTheMarket( Summary summary ) : base(2) { this.rowDescription = "Average permanence time on the market (minutes)"; double totalNumberOfMinutesOnTheMarket = 0.0; int totalNumberOfRoundTrades = 0; this.transactions = summary.AccountReport.TransactionTable.DataTable; this.setFieldNames(); for(int rowIndex = 0; rowIndex<this.transactions.Rows.Count; rowIndex++) { if( this.doesCurrentRowIndexPointToABuyLongOrASellShort( rowIndex ) ) { totalNumberOfRoundTrades++; totalNumberOfMinutesOnTheMarket += this.getMinutesForCurrentRoundTrade(rowIndex); } } this.rowValue = totalNumberOfMinutesOnTheMarket / (double)totalNumberOfRoundTrades; } } } |
|
From: Marco M. <mi...@us...> - 2009-03-21 09:53:02
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22322/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Modified Files: Transactions.cs Log Message: Added static property FieldNameForTransactionType Index: Transactions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Transactions.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Transactions.cs 10 Mar 2009 23:17:45 -0000 1.7 --- Transactions.cs 21 Mar 2009 09:52:57 -0000 1.8 *************** *** 19,22 **** --- 19,26 ---- get{ return "InstrumentKey"; } } + public static string FieldNameForTransactionType + { + get{ return "TransactionType"; } + } public Transactions( string reportName , DataTable detailedDataTable ) : base( reportName + " - Transactions" ) |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:38:28
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1288/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer Modified Files: PairsViewer.cs Log Message: A FixedPreviousDateAtClose IIntervalBeginFinder is used now (and it's easy to switch back to a MovingPreviousDateAtClose) Index: PairsViewer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer/PairsViewer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PairsViewer.cs 9 Mar 2009 22:43:08 -0000 1.1 --- PairsViewer.cs 16 Mar 2009 22:38:13 -0000 1.2 *************** *** 86,90 **** #region addItemsToHistory ! private void addItemToHistory( WeightedPosition weightedPosition , DateTime dateTime , History history ) { --- 86,91 ---- #region addItemsToHistory ! #region addItemToHistory ! private void addItemToHistory_actually( WeightedPosition weightedPosition , DateTime dateTime , History history ) { *************** *** 100,103 **** --- 101,113 ---- } } + private void addItemToHistory( + WeightedPosition weightedPosition , DateTime dateTime , History history ) + { + if ( HistoricalEndOfDayTimer.IsMarketTime( dateTime ) ) + this.addItemToHistory_actually( + weightedPosition , dateTime , history ); + } + #endregion addItemToHistory + private void addItemsToHistory( WeightedPosition weightedPosition , History history ) { *************** *** 149,153 **** #endregion showHistoriesPlots ! void ButtonShowClick(object sender, EventArgs e) --- 159,175 ---- #endregion showHistoriesPlots ! private IIntervalBeginFinder getIntervalBeginFinder( History firstTickerMarketValues ) ! { ! // IIntervalBeginFinder intervalBeginFinder = new MovingPreviousDateAtClose(); ! ! DateTime previousDayAtClose = ! MovingPreviousDateAtClose.GetPreviousDateAtClose( ! (DateTime)firstTickerMarketValues.GetKey( 0 ) ); ! IIntervalBeginFinder intervalBeginFinder = ! new FixedPreviousDateAtClose( ! this.firstWeightedPosition.Ticker , this.secondWeightedPosition.Ticker , ! previousDayAtClose , this.historicalMarketValueProvider ); ! return intervalBeginFinder; ! } void ButtonShowClick(object sender, EventArgs e) *************** *** 155,160 **** History firstTickerMarketValues = this.getHistory( this.firstWeightedPosition ); History secondTickerMarketValues = this.getHistory( this.secondWeightedPosition ); ReturnsComputer returnsComputer = ! new ReturnsComputer( this.historicalMarketValueProvider ); History firstTickerReturns = returnsComputer.GetReturns( this.firstWeightedPosition , firstTickerMarketValues ); --- 177,186 ---- History firstTickerMarketValues = this.getHistory( this.firstWeightedPosition ); History secondTickerMarketValues = this.getHistory( this.secondWeightedPosition ); + IIntervalBeginFinder intervalBeginFinder = this.getIntervalBeginFinder( + firstTickerMarketValues ); ReturnsComputer returnsComputer = ! new ReturnsComputer( ! this.historicalMarketValueProvider , ! intervalBeginFinder ); History firstTickerReturns = returnsComputer.GetReturns( this.firstWeightedPosition , firstTickerMarketValues ); |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:33:47
|
Update of /cvsroot/quantproject/QuantProject/b1_ADT/Timing In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32573/b1_ADT/Timing Modified Files: Date.cs Log Message: The follwing properties have been added: public int Year public int Month public int Day The following public method has been added public Date AddDays( int days ) Index: Date.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b1_ADT/Timing/Date.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Date.cs 20 Nov 2008 20:26:01 -0000 1.1 --- Date.cs 16 Mar 2009 22:33:36 -0000 1.2 *************** *** 32,35 **** --- 32,48 ---- DateTime standardDateTime; + public int Year + { + get { return this.standardDateTime.Year; } + } + public int Month + { + get { return this.standardDateTime.Month; } + } + public int Day + { + get { return this.standardDateTime.Day; } + } + // Represents a date (for any possible time) public Date( DateTime dateTime ) *************** *** 46,49 **** --- 59,69 ---- new DateTime( year , month , day , 0 , 0 , 0 ); } + + public Date AddDays( int days ) + { + DateTime standardDateTimeForResult = this.standardDateTime.AddDays( days ); + Date date = new Date( standardDateTimeForResult ); + return date; + } |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:32:31
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32220/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: - WalkForwardTesting\PairsTrading\Logging\PairsViewer\Intervals\FixedPreviousDateAtClose.cs has been added - WalkForwardTesting\PairsTrading\Logging\PairsViewer\Intervals\IIntervalBeginFinder.cs has been added - WalkForwardTesting\PairsTrading\Logging\PairsViewer\Intervals\MovingPreviousDateAtClose.cs has been added Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Scripts_SD.csproj 13 Mar 2009 15:19:10 -0000 1.39 --- Scripts_SD.csproj 16 Mar 2009 22:32:14 -0000 1.40 *************** *** 128,131 **** --- 128,134 ---- <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsTradingLogItem.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsTradingSerializedReportViewer.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsViewer\Intervals\FixedPreviousDateAtClose.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsViewer\Intervals\IIntervalBeginFinder.cs" /> + <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsViewer\Intervals\MovingPreviousDateAtClose.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsViewer\PairsViewer.cs" /> <Compile Include="WalkForwardTesting\PairsTrading\Logging\PairsViewer\PairsViewer.Designer.cs"> *************** *** 315,318 **** --- 318,322 ---- <Folder Include="WalkForwardTesting\PairsTrading\ExitStrategies" /> <Folder Include="WalkForwardTesting\PairsTrading\Logging\PairsViewer" /> + <Folder Include="WalkForwardTesting\PairsTrading\Logging\PairsViewer\Intervals" /> <Folder Include="WalkForwardTesting\PairsTrading\OutOfSampleChoosers" /> <Folder Include="WalkForwardTesting\PairsTrading\OutOfSampleChoosers\InefficiencyCorrectionDetecion" /> |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:31:05
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer/Intervals In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31892/PairsViewer/Intervals Added Files: FixedPreviousDateAtClose.cs Log Message: The interval begin is fixed, meaning that for every request the same interval begin is computed; the interval begin that's returned has the following features: - both firstTicker and secondTicker have been exchanged at that time - the returned date time is equal or before maxAllowedDateTime - an effort is made return a date time that is as close as possible to maxAllowedDateTime --- NEW FILE: FixedPreviousDateAtClose.cs --- /* QuantProject - Quantitative Finance Library FixedPreviousDateAtClose.cs Copyright (C) 2009 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.Timing; using QuantProject.Business.DataProviders; using QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading { /// <summary> /// The interval begin is fixed, meaning that for every request the same /// interval begin is computed; the interval begin that's returned has the following features: /// - both firstTicker and secondTicker have been exchanged at that time /// - the returned date time is equal or before maxAllowedDateTime /// - an effort is made return a date time that is as close as possible to maxAllowedDateTime /// </summary> public class FixedPreviousDateAtClose : IIntervalBeginFinder { DateTime intervalBegin; HistoricalMarketValueProvider historicalMarketValueProvider; public FixedPreviousDateAtClose( string firstTicker , string secondTicker , DateTime maxAllowedDateTime , HistoricalMarketValueProvider historicalMarketValueProvider ) { this.historicalMarketValueProvider = historicalMarketValueProvider; this.intervalBegin = this.findIntervalBegin( firstTicker , secondTicker , maxAllowedDateTime ); } #region findIntervalBegin private void checkForLoop( Date nextDateToTry , DateTime maxAllowedDateTime ) { DateTime dateTimeToBeSubtracted = new DateTime( nextDateToTry.Year , nextDateToTry.Month , nextDateToTry.Day , 0 , 0 , 0 ); TimeSpan timeSpan = maxAllowedDateTime.Subtract( dateTimeToBeSubtracted ); if ( timeSpan.Days >= 15 ) throw new Exception( "No eligible date time has been found in the previous 15 days. " + "You might want to check maxAllowedDateTime" ); } #region tryThisDate #region areExchangedInTheDay #region isExchanged #region getDateTimesToTry private Time getFirstTimeToTry( Date dateToTry , DateTime maxAllowedDateTime ) { Time firstTimeToTry = new Time( maxAllowedDateTime ); Date dateForMaxAllowedDateTime = new Date( maxAllowedDateTime ); if ( dateToTry < dateForMaxAllowedDateTime ) // the first tried date had no quotes for both tickers; we are now // examining earlier days firstTimeToTry = new Time( 15 , 59 , 0 ); return firstTimeToTry; } private void addForCurrentTime( Time currentTime , Date dateToTry , List<DateTime> dateTimesToTry ) { DateTime dateTime = new DateTime( dateToTry.Year , dateToTry.Month , dateToTry.Day , currentTime.Hour , currentTime.Minute , currentTime.Second ); dateTimesToTry.Add( dateTime ); } private List<DateTime> getDateTimesToTry( Date dateToTry , DateTime maxAllowedDateTime ) { List<DateTime> dateTimesToTry = new List<DateTime>(); Time currentTime = this.getFirstTimeToTry( dateToTry , maxAllowedDateTime ); while ( currentTime >= HistoricalEndOfDayTimer.TimeForMarketOpen ) { this.addForCurrentTime( currentTime , dateToTry , dateTimesToTry ); currentTime = currentTime.AddMinutes( -29 ); } return dateTimesToTry; } #endregion getDateTimesToTry #region isExchanged private bool isExchanged( string ticker , List<DateTime> dateTimesToTry ) { bool isExchangedVerified = false; int currentDateTimeToTryIndex = 0; while ( !isExchangedVerified && ( currentDateTimeToTryIndex < dateTimesToTry.Count ) ) { DateTime dateTimeToTry = dateTimesToTry[ currentDateTimeToTryIndex ]; isExchangedVerified = this.historicalMarketValueProvider.WasExchanged( ticker , dateTimeToTry ); currentDateTimeToTryIndex++; } return isExchangedVerified; } #endregion isExchanged private bool isExchanged( string ticker , Date dateToTry , DateTime maxAllowedDateTime ) { List<DateTime> dateTimesToTry = this.getDateTimesToTry( dateToTry , maxAllowedDateTime ); bool isActuallyExchanged = this.isExchanged( ticker , dateTimesToTry ); return isActuallyExchanged; } #endregion isExchanged private bool areExchangedInTheDay( string firstTicker , string secondTicker , Date dateToTry , DateTime maxAllowedDateTime ) { bool areExchanged = this.isExchanged( firstTicker , dateToTry , maxAllowedDateTime ) && this.isExchanged( secondTicker , dateToTry , maxAllowedDateTime ); return areExchanged; } #endregion areExchangedInTheDay #region findTheLatestCommonDateTime private DateTime getFirstDateTimeToTry( Date dateToTry , DateTime maxAllowedDateTime ) { DateTime firstDateTimeToTry = new DateTime( dateToTry.Year , dateToTry.Month , dateToTry.Day , 15 , 59 , 0 ); if ( maxAllowedDateTime < firstDateTimeToTry ) firstDateTimeToTry = maxAllowedDateTime; return firstDateTimeToTry; } private DateTime findTheLatestCommonDateTime( string firstTicker , string secondTicker , Date dateToTry , DateTime maxAllowedDateTime ) { DateTime latestCommonDateTime = DateTime.MinValue; DateTime dateTimeToTry = this.getFirstDateTimeToTry( dateToTry , maxAllowedDateTime ); while ( latestCommonDateTime == DateTime.MinValue ) { if ( this.historicalMarketValueProvider.WasExchanged( firstTicker , dateTimeToTry ) && this.historicalMarketValueProvider.WasExchanged( secondTicker , dateTimeToTry ) ) // both firstTicker and secondTicker are exchanged at dateTimeToTry latestCommonDateTime = dateTimeToTry; dateTimeToTry = dateTimeToTry.AddMinutes( -1 ); } return latestCommonDateTime; } #endregion findTheLatestCommonDateTime private DateTime tryThisDate( string firstTicker , string secondTicker , Date dateToTry , DateTime maxAllowedDateTime ) { DateTime dateTime = DateTime.MinValue; if ( this.areExchangedInTheDay( firstTicker , secondTicker , dateToTry , maxAllowedDateTime ) ) dateTime = this.findTheLatestCommonDateTime( firstTicker , secondTicker , dateToTry , maxAllowedDateTime ); return dateTime; } #endregion tryThisDate private DateTime findIntervalBegin( string firstTicker , string secondTicker , DateTime maxAllowedDateTime ) { Date nextDateToTry = new Date( maxAllowedDateTime ); DateTime intervalBeginCandidate = this.tryThisDate( firstTicker , secondTicker , nextDateToTry , maxAllowedDateTime ); while ( intervalBeginCandidate == DateTime.MinValue ) { // nextDateToTry does not contain a minute with a market value for both tickers nextDateToTry = nextDateToTry.AddDays( -1 ); intervalBeginCandidate = this.tryThisDate( firstTicker , secondTicker , nextDateToTry , maxAllowedDateTime ); this.checkForLoop( nextDateToTry , maxAllowedDateTime ); } return intervalBeginCandidate; } #endregion findIntervalBegin public DateTime GetIntervalBeginDateTime( DateTime dateTime ) { // DateTime yesterday = dateTime.AddDays( -1 ); // DateTime yesterdayAtClose = HistoricalEndOfDayTimer.GetMarketClose( yesterday ); // DateTime intervalBeginDateTime = yesterdayAtClose.AddMinutes( -1 ); return this.intervalBegin; } } } |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:30:24
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer/Intervals In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31723/PairsViewer/Intervals Added Files: MovingPreviousDateAtClose.cs Log Message: For any given date time, it is returned the day before at 15:59 --- NEW FILE: MovingPreviousDateAtClose.cs --- /* QuantProject - Quantitative Finance Library MovingPreviousDateAtClose.cs Copyright (C) 2009 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 QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.PairsTrading { /// <summary> /// For any given date time, it is returned the day before at 15:59 /// </summary> public class MovingPreviousDateAtClose : IIntervalBeginFinder { public MovingPreviousDateAtClose() { } public DateTime GetIntervalBeginDateTime( DateTime dateTime ) { // DateTime yesterday = dateTime.AddDays( -1 ); // DateTime yesterdayAtClose = HistoricalEndOfDayTimer.GetMarketClose( yesterday ); // DateTime intervalBeginDateTime = yesterdayAtClose.AddMinutes( -1 ); DateTime intervalBeginDateTime = MovingPreviousDateAtClose.GetPreviousDateAtClose( dateTime ); return intervalBeginDateTime; } public static DateTime GetPreviousDateAtClose( DateTime dateTime ) { DateTime yesterday = dateTime.AddDays( -1 ); DateTime yesterdayAtClose = HistoricalEndOfDayTimer.GetMarketClose( yesterday ); DateTime intervalBeginDateTime = yesterdayAtClose.AddMinutes( -1 ); return intervalBeginDateTime; } } } |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:29:59
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer/Intervals In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31523/PairsViewer/Intervals Added Files: IIntervalBeginFinder.cs Log Message: Returns the interval begin to be used by the ReturnsComputer --- NEW FILE: IIntervalBeginFinder.cs --- /* QuantProject - Quantitative Finance Library IIntervalBeginFinder.cs Copyright (C) 2009 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.Scripts.WalkForwardTesting.PairsTrading { /// <summary> /// Returns the interval begin to be used by the ReturnsComputer /// </summary> public interface IIntervalBeginFinder { /// <summary> /// returns the first date time for the interval that ends on dateTime: the /// interval that comes up will be used to calculate a return /// </summary> /// <param name="dateTime"></param> /// <returns></returns> DateTime GetIntervalBeginDateTime( DateTime dateTime ); } } |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:29:25
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31440/PairsViewer Modified Files: ReturnsComputer.cs Log Message: In this revision a IIntervalBeginFinder is used to find the DateTime that begins the interval on which the return is computed Index: ReturnsComputer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer/ReturnsComputer.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReturnsComputer.cs 9 Mar 2009 22:43:31 -0000 1.1 --- ReturnsComputer.cs 16 Mar 2009 22:29:18 -0000 1.2 *************** *** 36,39 **** --- 36,40 ---- { private HistoricalMarketValueProvider historicalMarketValueProvider; + private IIntervalBeginFinder intervalBeginFinder; private DateTime lastComputedIntervalBeginDateTime; *************** *** 41,47 **** private double marketValueAtTheIntervalBegin; ! public ReturnsComputer( HistoricalMarketValueProvider historicalMarketValueProvider ) { this.historicalMarketValueProvider = historicalMarketValueProvider; this.lastComputedIntervalBeginDateTime = DateTime.MinValue; --- 42,51 ---- private double marketValueAtTheIntervalBegin; ! public ReturnsComputer( ! HistoricalMarketValueProvider historicalMarketValueProvider , ! IIntervalBeginFinder intervalBeginFinder ) { this.historicalMarketValueProvider = historicalMarketValueProvider; + this.intervalBeginFinder = intervalBeginFinder; this.lastComputedIntervalBeginDateTime = DateTime.MinValue; *************** *** 60,73 **** #region updateCacheValueForIntervalBeginDateTime ! protected virtual DateTime getIntervalBeginDateTime( DateTime dateTime ) ! { ! DateTime yesterday = dateTime.AddDays( -1 ); ! DateTime yesterdayAtClose = HistoricalEndOfDayTimer.GetMarketClose( yesterday ); ! DateTime intervalBeginDateTime = yesterdayAtClose.AddMinutes( -1 ); ! return intervalBeginDateTime; ! } private bool updateLastComputedIntervalBeginDateTime( DateTime dateTime ) { ! DateTime intervalBeginDateTime = this.getIntervalBeginDateTime( dateTime ); bool isUpdated = ( intervalBeginDateTime != this.lastComputedIntervalBeginDateTime ); if ( isUpdated ) --- 64,79 ---- #region updateCacheValueForIntervalBeginDateTime ! // protected virtual DateTime getIntervalBeginDateTime( DateTime dateTime ) ! // { ! // DateTime yesterday = dateTime.AddDays( -1 ); ! // DateTime yesterdayAtClose = HistoricalEndOfDayTimer.GetMarketClose( yesterday ); ! // DateTime intervalBeginDateTime = yesterdayAtClose.AddMinutes( -1 ); ! // return intervalBeginDateTime; ! // } private bool updateLastComputedIntervalBeginDateTime( DateTime dateTime ) { ! // DateTime intervalBeginDateTime = this.getIntervalBeginDateTime( dateTime ); ! DateTime intervalBeginDateTime = ! this.intervalBeginFinder.GetIntervalBeginDateTime( dateTime ); bool isUpdated = ( intervalBeginDateTime != this.lastComputedIntervalBeginDateTime ); if ( isUpdated ) *************** *** 84,90 **** // the ticker has changed since the last return calculation this.currentTicker = weightedPosition.Ticker; ! return isUpdated; } ! private void updateCacheValuesForIntervalBeginIfTheCase( DateTime dateTime , WeightedPosition weightedPosition ) --- 90,96 ---- // the ticker has changed since the last return calculation this.currentTicker = weightedPosition.Ticker; ! return isUpdated; } ! private void updateCacheValuesForIntervalBeginIfTheCase( DateTime dateTime , WeightedPosition weightedPosition ) *************** *** 102,106 **** #endregion updateCacheValuesForIntervalBeginIfTheCase ! protected virtual double getMarketValueAtTheIntervalBegin( DateTime dateTime , WeightedPosition weightedPosition ) { --- 108,112 ---- #endregion updateCacheValuesForIntervalBeginIfTheCase ! private double getMarketValueAtTheIntervalBegin( DateTime dateTime , WeightedPosition weightedPosition ) { |
|
From: Glauco S. <gla...@us...> - 2009-03-16 22:26:19
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer/Intervals In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30477/Intervals Log Message: Directory /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/Logging/PairsViewer/Intervals added to the repository |
|
From: Glauco S. <gl...@my...> - 2009-03-14 17:35:40
|
mar...@po... wrote: > in effetti quando devo scrivere uno switch non faccio altro che copiare: > strano che non ti abbia copiato anche l'eccezione ... :-) o forse non c'era > e ci stai pensando adesso? > Se hai copiato da un mio switch analogo e non c'era l'eccezione, e' perche' e' codice vecchio assai (ed effettivamente, i quotes provider hanno qualche annetto). |
|
From: marco\.milletti\@poste\.it <mar...@po...> - 2009-03-14 16:25:26
|
>From :"Glau Silipr" gl...@gm... To :"QuantProject developers" qua...@li... Cc : Date :Sat, 14 Mar 2009 15:41:26 +0100 Subject :Re: [Quantproject-developers] QuantProject/b3_Data/DataProviders/Bars/Caching SimpleBarCache.cs, 1.4, 1.5 > Cacchio, gran bella idea questa!>> Io mi ero (stupidamente) ancorato alla convinzione di dover modificare> GetMarketValue() per gestire i diversi bar components.>> Questo approccio apre la strada ad un semplice e veloce arricchimento di> tutte le altre cache (e anche degli script chiamanti, che temevo di> dover modificare).>> Solo una cosa: nella strada "default" dello switch, non sarebbe meglio> lanciare un'eccezione? (in casi analoghi ho fatto questa scelta, perche'> se si dovesse aggiungere una barComponent (improbabile, lo so) avremmo> subito un run time error che ci indicherebbe che dobbiamo completare lo> switch) in effetti quando devo scrivere uno switch non faccio altro che copiare: strano che non ti abbia copiato anche l'eccezione ... :-) o forse non c'era e ci stai pensando adesso? Aggiungi pure l'eccezione, se vuoi: mi sembra un'ottima idea. |
|
From: Glau S. <gl...@gm...> - 2009-03-14 14:41:44
|
Cacchio, gran bella idea questa! Io mi ero (stupidamente) ancorato alla convinzione di dover modificare GetMarketValue() per gestire i diversi bar components. Questo approccio apre la strada ad un semplice e veloce arricchimento di tutte le altre cache (e anche degli script chiamanti, che temevo di dover modificare). Solo una cosa: nella strada "default" dello switch, non sarebbe meglio lanciare un'eccezione? (in casi analoghi ho fatto questa scelta, perche' se si dovesse aggiungere una barComponent (improbabile, lo so) avremmo subito un run time error che ci indicherebbe che dobbiamo completare lo switch) Marco Milletti wrote: > Update of /cvsroot/quantproject/QuantProject/b3_Data/DataProviders/Bars/Caching > In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27063/b3_Data/DataProviders/Bars/Caching > > Modified Files: > SimpleBarCache.cs > Log Message: > no message > > ! default: > ! returnValue = QuantProject.DataAccess.Tables.Bars.GetOpen( ticker , dateTime , this.intervalFrameInSeconds ); > ! break; > ! } > } > catch( EmptyQueryException ex ) > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Quantproject-developers mailing list > Qua...@li... > https://lists.sourceforge.net/lists/listinfo/quantproject-developers > > > |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:19:39
|
Update of /cvsroot/quantproject/QuantProject/b4_Business In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32287/b4_Business Modified Files: Business_SD.csproj Log Message: Updated SD project's files Index: Business_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/Business_SD.csproj,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Business_SD.csproj 28 Feb 2009 18:15:43 -0000 1.36 --- Business_SD.csproj 13 Mar 2009 15:19:10 -0000 1.37 *************** *** 48,51 **** --- 48,52 ---- <Compile Include="a05_Timing\IndexBasedHistoricalTimer.cs" /> <Compile Include="a05_Timing\Timer.cs" /> + <Compile Include="a07_DataProviders\HistoricalBarInterpolatingProvider.cs" /> <Compile Include="a07_DataProviders\HistoricalMarketValueProviderWithQuoteBackupOnClose.cs" /> <Compile Include="a07_DataProviders\PriceAdjustmentDetector.cs" /> *************** *** 74,77 **** --- 75,79 ---- <Compile Include="a2_Strategies\Benchmark.cs" /> <Compile Include="a2_Strategies\Eligibles\ByPriceLessVolatileOTCAlwaysQuoted.cs" /> + <Compile Include="a2_Strategies\Eligibles\ByPriceMostLiquidAlwaysIntradayQuoted.cs" /> <Compile Include="a2_Strategies\Eligibles\ByPriceMostLiquidLessVolatileCTCAlwaysQuoted.cs" /> <Compile Include="a2_Strategies\Eligibles\ByPriceMostLiquidLessVolatileCTOAlwaysQuoted.cs" /> *************** *** 116,119 **** --- 118,122 ---- <Compile Include="a2_Strategies\returnsManagement\time\DailyOpenToCloseIntervals.cs" /> <Compile Include="a2_Strategies\returnsManagement\time\IntervalsType.cs" /> + <Compile Include="a2_Strategies\returnsManagement\time\IntradayReturnIntervals.cs" /> <Compile Include="a2_Strategies\returnsManagement\time\OpenToCloseCloseToOpenIntervals.cs" /> <Compile Include="a2_Strategies\returnsManagement\time\OpenToOpenIntervals.cs" /> *************** *** 127,130 **** --- 130,134 ---- <Compile Include="a2_Strategies\TickersRelationships\CloseToOpenCorrelationProvider.cs" /> <Compile Include="a2_Strategies\TickersRelationships\CorrelationProvider.cs" /> + <Compile Include="a2_Strategies\TickersRelationships\IntradayCorrelationProvider.cs" /> <Compile Include="a2_Strategies\TickersRelationships\MissingCorrelationException.cs" /> <Compile Include="a2_Strategies\TickersRelationships\OpenToCloseCloseToOpenCorrelationProvider.cs" /> |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:19:31
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32287/b7_Scripts Modified Files: Scripts_SD.csproj Log Message: Updated SD project's files Index: Scripts_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/Scripts_SD.csproj,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Scripts_SD.csproj 9 Mar 2009 22:44:33 -0000 1.38 --- Scripts_SD.csproj 13 Mar 2009 15:19:10 -0000 1.39 *************** *** 73,76 **** --- 73,77 ---- <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOCorrelationChooser.cs" /> <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOGeneticChooser.cs" /> + <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVOIntradayCorrelationChooser.cs" /> <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVO_CTCCorrelationChooser.cs" /> <Compile Include="TechnicalAnalysisTesting\Oscillators\FixedLevelOscillators\PortfolioValueOscillator\InSampleChoosers\PVO_CTCStrongCorrelationChooser.cs" /> *************** *** 288,292 **** <Folder Include="EvaluatingOptimizationTechnique\" /> <Folder Include="EvaluatingOptimizationTechnique\EfficientPortfolio\" /> - <Folder Include="BackTesting" /> <Folder Include="General\Strategies" /> <Folder Include="TechnicalAnalysisTesting\Oscillators\ExtremeCounterTrend" /> --- 289,292 ---- |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:19:21
|
Update of /cvsroot/quantproject/QuantProject/b3_Data In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32287/b3_Data Modified Files: Data_SD.csproj Log Message: Updated SD project's files Index: Data_SD.csproj =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b3_Data/Data_SD.csproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Data_SD.csproj 5 Feb 2009 22:11:16 -0000 1.7 --- Data_SD.csproj 13 Mar 2009 15:19:10 -0000 1.8 *************** *** 75,78 **** --- 75,79 ---- <Compile Include="Selectors\SelectorByCloseToCloseLinearCorrelation.cs" /> <Compile Include="Selectors\SelectorByCloseToCloseVolatility.cs" /> + <Compile Include="Selectors\SelectorByIntradayQuotationAtEachMarketDay.cs" /> <Compile Include="Selectors\SelectorByLiquidity.cs" /> <Compile Include="Selectors\SelectorByOpenToCloseLinearCorrelation.cs" /> |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:18:05
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/Eligibles In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31903/b4_Business/a2_Strategies/Eligibles Added Files: ByPriceMostLiquidAlwaysIntradayQuoted.cs Log Message: Added a new eligible selector: liquidity is computed using quotes table (that contains EOD data) --- NEW FILE: ByPriceMostLiquidAlwaysIntradayQuoted.cs --- /* QuantProject - Quantitative Finance Library ByPriceMostLiquidAlwaysIntradayQuoted.cs Copyright (C) 2009 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.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 intraday quoted (the ones that have at least /// the given number of 60seconds-bars for each market day) are selected /// (not more than a given max number); /// </summary> [Serializable] public class ByPriceMostLiquidAlwaysIntradayQuoted : IEligiblesSelector { public event NewMessageEventHandler NewMessage; private bool temporizedGroup; private string tickersGroupID; private Benchmark benchmark; private int maxNumberOfEligibleTickersToBeChosen; private int numOfDaysForAverageOpenRawPriceComputation; private double minPrice; private double maxPrice; private int minimumNumberOfBars; 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 intraday quoted at each market day (MSFT) for the in sample time frame"; } } public ByPriceMostLiquidAlwaysIntradayQuoted( string tickersGroupID , Benchmark benchmark, bool temporizedGroup, int maxNumberOfEligibleTickersToBeChosen, int numOfDaysForAverageOpenRawPriceComputation, double minPrice, double maxPrice, int minimumNumberOfBars) { this.temporizedGroup = temporizedGroup; this.tickersGroupID = tickersGroupID; this.benchmark = benchmark; this.maxNumberOfEligibleTickersToBeChosen = maxNumberOfEligibleTickersToBeChosen; this.numOfDaysForAverageOpenRawPriceComputation = numOfDaysForAverageOpenRawPriceComputation; this.minPrice = minPrice; this.maxPrice = maxPrice; this.minimumNumberOfBars = minimumNumberOfBars; } 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" ); SelectorByIntradayQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = new SelectorByIntradayQuotationAtEachMarketDay( dataTableMostLiquid , history.FirstDateTime, currentDate, minimumNumberOfBars, this.maxNumberOfEligibleTickersToBeChosen, this.benchmark.Ticker); DataTable dataTableToBeReturned = quotedAtEachMarketDayFromLastSelection.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...> - 2009-03-13 15:15:53
|
Update of /cvsroot/quantproject/QuantProject/b3_Data/Selectors In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31251/b3_Data/Selectors Added Files: SelectorByIntradayQuotationAtEachMarketDay.cs Log Message: Added a new selector for tickers that have at least a given number of bars in each market day (market days list is provided by a given benchmark, as usual) --- NEW FILE: SelectorByIntradayQuotationAtEachMarketDay.cs --- /* QuantProject - Quantitative Finance Library SelectorByIntradayQuotationAtEachMarketDay.cs Copyright (C) 2009 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 with at least /// the given number of 60 seconds-bars /// for each market day in the given marketDays History /// (or the days History the given market index is quoted) /// </summary> public class SelectorByIntradayQuotationAtEachMarketDay : TickerSelector , ITickerSelector { private string marketIndex; private History marketDays; private int minimumNumberOfBarsForEachMarketDay; public SelectorByIntradayQuotationAtEachMarketDay(DataTable setOfTickersToBeSelected, DateTime firstQuoteDate, DateTime lastQuoteDate, int minimumNumberOfBarsForEachMarketDay, long maxNumOfReturnedTickers, string marketIndex): base(setOfTickersToBeSelected, false, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { this.marketIndex = marketIndex; this.minimumNumberOfBarsForEachMarketDay = minimumNumberOfBarsForEachMarketDay; } public SelectorByIntradayQuotationAtEachMarketDay(string groupID, DateTime firstQuoteDate, DateTime lastQuoteDate, int minimumNumberOfBarsForEachMarketDay, long maxNumOfReturnedTickers, string marketIndex): base(groupID, false, firstQuoteDate, lastQuoteDate, maxNumOfReturnedTickers) { this.marketIndex = marketIndex; this.minimumNumberOfBarsForEachMarketDay = minimumNumberOfBarsForEachMarketDay; } public SelectorByIntradayQuotationAtEachMarketDay( DataTable setOfTickersToBeSelected , History marketDays , int minimumNumberOfBarsForEachMarketDay, long maxNumOfReturnedTickers ): base(setOfTickersToBeSelected , false , marketDays.FirstDateTime , marketDays.LastDateTime , maxNumOfReturnedTickers ) { this.marketIndex = ""; this.marketDays = marketDays; this.minimumNumberOfBarsForEachMarketDay = minimumNumberOfBarsForEachMarketDay; } #region GetTableOfSelectedTickers #region getTickersWithBarsInEachMarketDay private void getTickersQuotedInEachMarketDay_addRow(DataRow rowToBeAdded, int numberOfTradingDays, DataTable tableToWhichRowIsToBeAdded) { DataRow newRow = tableToWhichRowIsToBeAdded.NewRow(); newRow[0]= rowToBeAdded[0]; newRow["NumberOfDaysWithBars"] = numberOfTradingDays; tableToWhichRowIsToBeAdded.Rows.Add(newRow); } private void getTickersQuotedInEachMarketDay_handleRow( DataRow row , DataTable tableToWhichRowIsToBeAdded ) { History marketDaysForTicker = QuantProject.Data.DataTables.Bars.GetMarketDays( (string)row[0], this.firstQuoteDate , this.lastQuoteDate, 60, this.minimumNumberOfBarsForEachMarketDay ); if( marketDaysForTicker.ContainsAllTheDatesIn( this.marketDays ) ) //the current ticker has been effectively traded in each market day this.getTickersQuotedInEachMarketDay_addRow( row , marketDaysForTicker.Count , tableToWhichRowIsToBeAdded ); } private DataTable getTickersWithBarsInEachMarketDay_givenMarketDaysAndGivenSetOfTickers() { if(!this.setOfTickersToBeSelected.Columns.Contains("NumberOfDaysWithBars")) this.setOfTickersToBeSelected.Columns.Add("NumberOfDaysWithBars", System.Type.GetType("System.Int32")); DataTable returnValue = this.setOfTickersToBeSelected.Clone(); foreach(DataRow row in setOfTickersToBeSelected.Rows) this.getTickersQuotedInEachMarketDay_handleRow( row , returnValue ); ExtendedDataTable.DeleteRows( returnValue, maxNumOfReturnedTickers ); return returnValue; } private DataTable getTickersWithBarsInEachMarketDay_givenGroupID() { this.setOfTickersToBeSelected = QuantProject.DataAccess.Tables.Tickers_tickerGroups.GetTickers(this.groupID); this.marketDays = QuantProject.Data.DataTables.Quotes.GetMarketDays(this.marketIndex, this.firstQuoteDate, this.lastQuoteDate); return getTickersWithBarsInEachMarketDay_givenMarketDaysAndGivenSetOfTickers(); } private DataTable getTickersWithBarsInEachMarketDay_givenSetOfTickers() { this.marketDays = QuantProject.Data.DataTables.Quotes.GetMarketDays(this.marketIndex, this.firstQuoteDate, this.lastQuoteDate); return getTickersWithBarsInEachMarketDay_givenMarketDaysAndGivenSetOfTickers(); } #endregion private DataTable getTableOfSelectedTickers_givenMarketDays() { DataTable dataTable = this.getTickersWithBarsInEachMarketDay_givenMarketDaysAndGivenSetOfTickers(); 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 this.getTickersWithBarsInEachMarketDay_givenGroupID(); else return this.getTickersWithBarsInEachMarketDay_givenSetOfTickers(); } public DataTable GetTableOfSelectedTickers() { if ( this.marketDays != null ) // marketDays has been passed to the constructor return this.getTableOfSelectedTickers_givenMarketDays(); else // marketIndex has been passed to the constructor return this.getTableOfSelectedTickers_givenMarketIndex(); } #endregion GetTableOfSelectedTickers public void SelectAllTickers() { ; } } } |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:13:34
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30530/b4_Business/a2_Strategies/TickersRelationships Added Files: IntradayCorrelationProvider.cs Log Message: Classes for intraday correlation analysis have been added --- NEW FILE: IntradayCorrelationProvider.cs --- /* QuantProject - Quantitative Finance Library IntradayCorrelationProvider.cs Copyright (C) 2009 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using System.Collections; using QuantProject.ADT.Statistics; using QuantProject.ADT.Timing; using QuantProject.Business.DataProviders; using QuantProject.Business.Timing; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Data.DataProviders.Bars.Caching; namespace QuantProject.Business.Strategies.TickersRelationships { /// <summary> /// Class that provides correlation's indexes two by two within a /// given set of tickers /// </summary> [Serializable] public class IntradayCorrelationProvider { protected ReturnsManager returnsManager; protected string[] tickers; protected float minimumAbsoluteReturnValue; protected float maximumAbsoluteReturnValue; protected int numOfCombinationTwoByTwo; protected TickersPearsonCorrelation[] pearsonCorrelations; protected int returnIntervalLengthInMinutes; // protected int maxNumberOfBarsToScanForFirstValidValue; protected string benchmark; private void correlationProvider_commonInitialization(string[] tickersToAnalyze, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue) { this.tickers = tickersToAnalyze; this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue; this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue; int n = this.tickers.Length; //combinations without repetitions: //n_fatt /( k_fatt * (n-k)_fatt ): when k = 2, // it can be reduced to this simple formula: this.numOfCombinationTwoByTwo = n * (n - 1) / 2; // this.maxNumberOfBarsToScanForFirstValidValue = 5; } /// <summary> /// Creates the correlation provider /// </summary> /// <param name="tickersToAnalyze">Array of tickers to be analyzed</param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <param name="minimumAbsoluteReturnValue">Both current tickers' returns /// have to be greater than minimumAbsoluteReturnValue for being considered /// significant and so computed in the correlation formula</param> /// <param name="maximumAbsoluteReturnValue">Both current tickers' returns /// have to be less than maximumAbsoluteReturnValue</param> /// <param name="benchmark">The benchmark used for computation /// of returns</param> public IntradayCorrelationProvider(string[] tickersToAnalyze, DateTime startDateTime, DateTime endDateTime, int returnIntervalLengthInMinutes, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue, string benchmark) { this.correlationProvider_commonInitialization(tickersToAnalyze, minimumAbsoluteReturnValue, maximumAbsoluteReturnValue); this.returnIntervalLengthInMinutes = returnIntervalLengthInMinutes; this.benchmark = benchmark; IntradayIntervals intradayIntervals = new IntradayIntervals(startDateTime, endDateTime , returnIntervalLengthInMinutes, "MSFT"); Time firstDailyTime = new Time(startDateTime.Hour, startDateTime.Minute, startDateTime.Second); Time lastDailyTime = new Time(endDateTime.Hour, endDateTime.Minute, endDateTime.Second); this.returnsManager = new ReturnsManager(intradayIntervals, new HistoricalBarInterpolatingProvider(new DailyBarCache(60, Time.GetIntermediateTimes(firstDailyTime, lastDailyTime, returnIntervalLengthInMinutes) ) ) ); } /// <summary> /// Creates the correlation provider /// </summary> /// <param name="tickersToAnalyze">Array of tickers to be analyzed</param> /// <param name="returnsManager"></param> /// <param name="minimumAbsoluteReturnValue">Both current tickers' returns /// have to be greater than minimumAbsoluteReturnValue for being considered /// significant and so computed in the correlation formula</param> /// <param name="maximumAbsoluteReturnValue">Both current tickers' returns /// have to be less than maximumAbsoluteReturnValue</param> public IntradayCorrelationProvider( string[] tickersToAnalyze, ReturnsManager returnsManager, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue ) { this.correlationProvider_commonInitialization(tickersToAnalyze, minimumAbsoluteReturnValue, maximumAbsoluteReturnValue); this.returnsManager = returnsManager; } protected float[] getOrderedTickersPearsonCorrelations_setCorrelations_getValue_getFilteredReturnsForFirstTicker( float[] firstTickerReturns, float[] secondTickerReturns) { float[] returnValue; float[] tempReturnValue = new float[firstTickerReturns.Length]; int countSignificantReturns = 0; for(int i = 0; i<firstTickerReturns.Length; i++) if( Math.Abs(firstTickerReturns[i]) >= this.minimumAbsoluteReturnValue && Math.Abs(firstTickerReturns[i]) <= this.maximumAbsoluteReturnValue && Math.Abs(secondTickerReturns[i]) >= this.minimumAbsoluteReturnValue && Math.Abs(secondTickerReturns[i]) <= this.maximumAbsoluteReturnValue ) { countSignificantReturns++; tempReturnValue[ countSignificantReturns - 1 ] = firstTickerReturns[ i ]; } returnValue = new float[countSignificantReturns]; Array.Copy(tempReturnValue, 0, returnValue, 0, countSignificantReturns); return returnValue; } protected double getOrderedTickersPearsonCorrelations_setCorrelations_getValue( int indexOfFirstTicker, int indexOfSecondTicker) { double returnValue; float[] firstTickerSignificantReturns = this.getOrderedTickersPearsonCorrelations_setCorrelations_getValue_getFilteredReturnsForFirstTicker( this.returnsManager.GetReturns(this.tickers[indexOfFirstTicker]), this.returnsManager.GetReturns(this.tickers[indexOfSecondTicker]) ); float[] secondTickerSignificantReturns = this.getOrderedTickersPearsonCorrelations_setCorrelations_getValue_getFilteredReturnsForFirstTicker( this.returnsManager.GetReturns(this.tickers[indexOfSecondTicker]), this.returnsManager.GetReturns(this.tickers[indexOfFirstTicker]) ); returnValue = BasicFunctions.PearsonCorrelationCoefficient( firstTickerSignificantReturns, secondTickerSignificantReturns ); if ( Double.IsNaN(returnValue) || Double.IsInfinity(returnValue) ) throw new MissingCorrelationException(this.tickers[indexOfFirstTicker], this.tickers[indexOfSecondTicker]); return returnValue; } protected void getOrderedTickersPearsonCorrelations_setCorrelations() { // if(this.returnsManager == null) // this.returnsManager = // new ReturnsManager(this.firstDateTime, // this.lastDateTime, // this.maxNumberOfBarsToScanForFirstValidValue); this.pearsonCorrelations = new TickersPearsonCorrelation[ this.numOfCombinationTwoByTwo ]; int index = 0; for (int i = 0; i < this.tickers.Length; i++) for (int j = i + 1; j < this.tickers.Length; j++) { try{ this.pearsonCorrelations[index] = new TickersPearsonCorrelation( this.tickers[i], this.tickers[j], this.getOrderedTickersPearsonCorrelations_setCorrelations_getValue( i , j) ); } catch(MissingCorrelationException ex) { string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; } index++; } Array.Sort(this.pearsonCorrelations); } private void showOutputToConsole() { System.Console.WriteLine("\n\rEligibles"); for(int i = 0; i < this.tickers.Length; i++) System.Console.WriteLine(this.tickers[i]); System.Console.WriteLine("\n\rCorrelations"); for(int i = 0; i < this.pearsonCorrelations.Length; i++) System.Console.WriteLine(this.pearsonCorrelations[i].FirstTicker + " " + this.pearsonCorrelations[i].SecondTicker + " " + this.pearsonCorrelations[i].CorrelationValue.ToString() ); } public TickersPearsonCorrelation[] GetOrderedTickersPearsonCorrelations() { if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); //this.showOutputToConsole(); return this.pearsonCorrelations; } public double GetPearsonCorrelation(string firstTicker, string secondTicker) { double returnValue = double.NaN; if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); for(int i = 0; i<this.pearsonCorrelations.Length; i++) { if( (this.pearsonCorrelations[i].FirstTicker == firstTicker && this.pearsonCorrelations[i].SecondTicker == secondTicker) || (this.pearsonCorrelations[i].FirstTicker == secondTicker && this.pearsonCorrelations[i].SecondTicker == firstTicker) ) { returnValue = this.pearsonCorrelations[i].CorrelationValue; i = this.pearsonCorrelations.Length;//exit from for } } if( double.IsNaN(returnValue) ) throw new MissingCorrelationException(firstTicker, secondTicker); return returnValue; } } // end of class } |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:13:24
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30530/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers Added Files: PVOIntradayCorrelationChooser.cs Log Message: Classes for intraday correlation analysis have been added --- NEW FILE: PVOIntradayCorrelationChooser.cs --- /* QuantProject - Quantitative Finance Library PVOIntradayCorrelationChooser.cs Copyright (C) 2009 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using QuantProject.ADT; using QuantProject.ADT.Messaging; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.InSample; using QuantProject.Business.Strategies.TickersRelationships; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.OutOfSample; namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.InSampleChoosers { /// <summary> /// PVOIntradayCorrelationChooser to be used for /// in sample optimization /// By means of correlation, the AnalyzeInSample method returns the /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> [Serializable] public class PVOIntradayCorrelationChooser : IInSampleChooser { public event NewProgressEventHandler NewProgress; public event NewMessageEventHandler NewMessage; protected float minimumAbsoluteReturnValue; protected float maximumAbsoluteReturnValue; //correlation is computed only for returns //between minimum and maximum protected IntradayCorrelationProvider intradayCorrelationProvider; protected int numberOfBestTestingPositionsToBeReturned; protected int numOfMinutesForOscillatingPeriod; protected double maxCorrelationValue; //correlations greater than this value are discarded protected bool balancedWeightsOnVolatilityBase; protected string benchmark; public virtual string Description { get { string description = "CorrelationChooserType:\n" + this.intradayCorrelationProvider.GetType().ToString() + "\n" + "NumOfTickersReturned:\n" + this.numberOfBestTestingPositionsToBeReturned.ToString() + "MaxCorrelationValue: " + this.maxCorrelationValue.ToString(); return description; } } public int ReturnIntervalLengthInMinutes { get { return this.numOfMinutesForOscillatingPeriod; } } /// <summary> /// PVOIntradayCorrelationChooser to be used for /// in sample optimization /// </summary> /// <param name="numberOfBestTestingPositionsToBeReturned"> /// The number of PVOPositions that the /// AnalyzeInSample method will return /// </param> /// <param name="numDaysForOscillatingPeriod"> /// Interval's length of the return for the PVOPosition /// to be checked out of sample, in order to update the /// status for the PVOPosition itself /// </param> /// <param name="maxCorrelationValue"> /// Correlations higher than given maxCorrelationValue are discarded /// (for avoiding analyzing tickers corresponding to the same stock) /// </param> public PVOIntradayCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, int numOfMinutesForOscillatingPeriod, double maxCorrelationValue, bool balancedWeightsOnVolatilityBase, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue, string benchmark) { this.numberOfBestTestingPositionsToBeReturned = numberOfBestTestingPositionsToBeReturned; this.numOfMinutesForOscillatingPeriod = numOfMinutesForOscillatingPeriod; this.maxCorrelationValue = maxCorrelationValue; this.balancedWeightsOnVolatilityBase = balancedWeightsOnVolatilityBase; this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue; this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue; this.benchmark = benchmark; } #region AnalyzeInSample private void analyzeInSample_checkParameters( EligibleTickers eligibleTickers , ReturnsManager returnsManager ) { if ( eligibleTickers.Count < 2 ) throw new Exception( "Eligible tickers contains " + "only " + eligibleTickers.Count + " elements, while Correlation computation requires at least 2 elements"); if (this.maxCorrelationValue < 0.0 || this.maxCorrelationValue > 1.0 ) throw new OutOfRangeException( "maxCorrelationValue", 0.0, 1.0); } protected void setCorrelationProvider(EligibleTickers eligibleTickers , ReturnsManager returnsManager) { // DateTime firstDate = returnsManager.ReturnIntervals[0].Begin; // DateTime lastDate = returnsManager.ReturnIntervals.LastDateTime; this.intradayCorrelationProvider = new IntradayCorrelationProvider(eligibleTickers.Tickers, returnsManager, this.minimumAbsoluteReturnValue, this.maximumAbsoluteReturnValue); } protected PVOPositions getTestingPositions(SignedTickers signedTickers, ReturnsManager returnsManager) { WeightedPositions weightedPositions; if(this.balancedWeightsOnVolatilityBase == true) weightedPositions = new WeightedPositions(WeightedPositions.GetBalancedWeights(signedTickers, returnsManager), signedTickers.Tickers); else//just equal weights weightedPositions = new WeightedPositions(signedTickers); return new PVOPositions(weightedPositions, 0.0, 0.0, this.numOfMinutesForOscillatingPeriod ); } private TestingPositions[] getBestTestingPositionsInSample( EligibleTickers eligibleTickers , ReturnsManager returnsManager ) { this.setCorrelationProvider(eligibleTickers , returnsManager); TestingPositions[] bestTestingPositions = new TestingPositions[this.numberOfBestTestingPositionsToBeReturned]; TickersPearsonCorrelation[] correlations = this.intradayCorrelationProvider.GetOrderedTickersPearsonCorrelations(); int addedTestingPositions = 0; int counter = 0; while(addedTestingPositions < this.numberOfBestTestingPositionsToBeReturned && counter < correlations.Length) { if(correlations[correlations.Length - 1 - counter].CorrelationValue < this.maxCorrelationValue) { SignedTickers signedTickers = new SignedTickers("-"+correlations[correlations.Length - 1 - counter].FirstTicker + ";" + correlations[correlations.Length - 1 - counter].SecondTicker); bestTestingPositions[addedTestingPositions] = this.getTestingPositions(signedTickers, returnsManager); ((PVOPositions)bestTestingPositions[addedTestingPositions]).FitnessInSample = correlations[correlations.Length - 1 - counter].CorrelationValue; addedTestingPositions++; } counter++; } return bestTestingPositions; } /// <summary> /// Returns the best TestingPositions with respect to the in sample data /// </summary> /// <param name="eligibleTickers"></param> /// <returns></returns> public object AnalyzeInSample( EligibleTickers eligibleTickers , ReturnsManager returnsManager ) { if ( this.NewMessage != null ) this.NewMessage( this , new NewMessageEventArgs( "New Correlation Analysis" ) ); if ( this.NewProgress != null ) this.NewProgress( this , new NewProgressEventArgs( 1 , 1 ) ); this.analyzeInSample_checkParameters( eligibleTickers , returnsManager ); TestingPositions[] bestTestingPositionsInSample = this.getBestTestingPositionsInSample( eligibleTickers , returnsManager ); return bestTestingPositionsInSample; } #endregion } } |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:13:24
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/returnsManagement/time In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30530/b4_Business/a2_Strategies/returnsManagement/time Added Files: IntradayReturnIntervals.cs Log Message: Classes for intraday correlation analysis have been added --- NEW FILE: IntradayReturnIntervals.cs --- /* QuantProject - Quantitative Finance Library IntradayReturnIntervals.cs Copyright (C) 2009 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 QuantProject.Business.Timing; namespace QuantProject.Business.Strategies.ReturnsManagement.Time { /// <summary> /// Intraday intervals to be used to compute intraday returns /// </summary> [Serializable] public class IntradayIntervals : ReturnIntervals { private QuantProject.ADT.Timing.Time firstDailyTime; private QuantProject.ADT.Timing.Time lastDailyTime; /// <summary> /// Creates the intraday intervals, of the given length in minutes, /// for the given benchmark, from /// the first DateTime to the last DateTime /// </summary> /// <param name="firstDateTime"></param> /// <param name="lastDateTime"></param> /// <param name="intervalLengthInMinutes"></param> /// <param name="benchmark"></param> public IntradayIntervals( DateTime firstDateTime , DateTime lastDateTime , int intervalLengthInMinutes, string benchmark ) : base( firstDateTime , lastDateTime , benchmark, intervalLengthInMinutes ) { } #region setIntervals private void addInterval( DateTime day, QuantProject.ADT.Timing.Time dailyTimeForIntervalBegin, QuantProject.ADT.Timing.Time dailyTimeForIntervalEnd ) { DateTime dateTimeForIntervalBegin = QuantProject.ADT.Timing.Time.GetDateTimeFromMerge(day, dailyTimeForIntervalBegin); DateTime dateTimeForIntervalEnd = QuantProject.ADT.Timing.Time.GetDateTimeFromMerge(day, dailyTimeForIntervalEnd); ReturnInterval returnInterval = new ReturnInterval( dateTimeForIntervalBegin , dateTimeForIntervalEnd ); this.Add( returnInterval ); } private void addIntervalsForTheCurrentDay( int indexOfDay ) { DateTime day = (DateTime)this.marketDaysForBenchmark.GetKey( indexOfDay ); QuantProject.ADT.Timing.Time currentBeginDailyTime = this.firstDailyTime; QuantProject.ADT.Timing.Time currentEndDailyTime = this.firstDailyTime.AddMinutes(this.intervalLength); while( currentBeginDailyTime < this.lastDailyTime && currentEndDailyTime <= this.lastDailyTime ) { this.addInterval( day, currentBeginDailyTime, currentEndDailyTime ); currentBeginDailyTime = currentEndDailyTime; currentEndDailyTime = currentBeginDailyTime.AddMinutes( intervalLength ); } } protected override void setIntervals() { this.firstDailyTime = new QuantProject.ADT.Timing.Time( this.firstDateTime.Hour, this.firstDateTime.Minute, this.firstDateTime.Second); this.lastDailyTime = new QuantProject.ADT.Timing.Time( this.lastDateTime.Hour, this.lastDateTime.Minute, this.lastDateTime.Second); for( int i = 0 ; i < this.marketDaysForBenchmark.Count ; i++ ) this.addIntervalsForTheCurrentDay( i ); } #endregion setIntervals } } |
|
From: Marco M. <mi...@us...> - 2009-03-13 15:12:04
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30121/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator Modified Files: PVOStrategyIntraday.cs PVOStrategyIntradayMain.cs Log Message: PVOStrategyIntraday has been updated Index: PVOStrategyIntraday.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOStrategyIntraday.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVOStrategyIntraday.cs 12 Jan 2009 18:11:01 -0000 1.3 --- PVOStrategyIntraday.cs 13 Mar 2009 15:12:01 -0000 1.4 *************** *** 104,108 **** --- 104,110 ---- protected double maxOpeningLengthInMinutes; protected double minutesFromLastInefficiencyTimeToWaitBeforeOpening; + protected double minutesFromLastLossOrProfitToWaitBeforeClosing; protected Time lastEntryTime; + protected Time lastProfitOrLossTime; protected Time lastInefficiencyTime; protected List<Time> openingTimesForAvailableBars; *************** *** 172,175 **** --- 174,178 ---- double inefficiencyLengthInMinutes, double minutesFromLastInefficiencyTimeToWaitBeforeOpening, + double minutesFromLastLossOrProfitToWaitBeforeClosing, double maxOpeningLengthInMinutes, List<Time> openingTimesForAvailableBars, *************** *** 191,194 **** --- 194,199 ---- this.minutesFromLastInefficiencyTimeToWaitBeforeOpening = minutesFromLastInefficiencyTimeToWaitBeforeOpening; + this.minutesFromLastLossOrProfitToWaitBeforeClosing = + minutesFromLastLossOrProfitToWaitBeforeClosing; this.maxOpeningLengthInMinutes = maxOpeningLengthInMinutes; this.openingTimesForAvailableBars = openingTimesForAvailableBars; *************** *** 200,204 **** this.lastEntryTime = new Time("00:00:00"); this.lastInefficiencyTime = new Time("00:00:00"); ! // this.optimalPositionsHaveBeenUpdated = false; } --- 205,209 ---- this.lastEntryTime = new Time("00:00:00"); this.lastInefficiencyTime = new Time("00:00:00"); ! this.lastProfitOrLossTime = new Time("00:00:00"); } *************** *** 217,220 **** --- 222,226 ---- double inefficiencyLengthInMinutes, double minutesFromLastInefficiencyTimeToWaitBeforeOpening, + double minutesFromLastLossOrProfitToWaitBeforeClosing, double maxOpeningLengthInMinutes, List<Time> openingTimesForAvailableBars, *************** *** 230,233 **** --- 236,240 ---- inefficiencyLengthInMinutes, minutesFromLastInefficiencyTimeToWaitBeforeOpening, + minutesFromLastLossOrProfitToWaitBeforeClosing, maxOpeningLengthInMinutes, openingTimesForAvailableBars, *************** *** 248,251 **** --- 255,259 ---- double inefficiencyLengthInMinutes, double minutesFromLastInefficiencyTimeToWaitBeforeOpening, + double minutesFromLastLossOrProfitToWaitBeforeClosing, double maxOpeningLengthInMinutes, List<Time> openingTimesForAvailableBars, *************** *** 261,264 **** --- 269,273 ---- inefficiencyLengthInMinutes, minutesFromLastInefficiencyTimeToWaitBeforeOpening, + minutesFromLastLossOrProfitToWaitBeforeClosing, maxOpeningLengthInMinutes, openingTimesForAvailableBars, *************** *** 280,283 **** --- 289,293 ---- double inefficiencyLengthInMinutes, double minutesFromLastInefficiencyTimeToWaitBeforeOpening, + double minutesFromLastLossOrProfitToWaitBeforeClosing, double maxOpeningLengthInMinutes, List<Time> openingTimesForAvailableBars, *************** *** 293,296 **** --- 303,307 ---- inefficiencyLengthInMinutes, minutesFromLastInefficiencyTimeToWaitBeforeOpening, + minutesFromLastLossOrProfitToWaitBeforeClosing, maxOpeningLengthInMinutes, openingTimesForAvailableBars, *************** *** 310,313 **** --- 321,325 ---- double inefficiencyLengthInMinutes, double minutesFromLastInefficiencyTimeToWaitBeforeOpening, + double minutesFromLastLossOrProfitToWaitBeforeClosing, double maxOpeningLengthInMinutes, List<Time> openingTimesForAvailableBars, *************** *** 322,325 **** --- 334,338 ---- inefficiencyLengthInMinutes, minutesFromLastInefficiencyTimeToWaitBeforeOpening, + minutesFromLastLossOrProfitToWaitBeforeClosing, maxOpeningLengthInMinutes, openingTimesForAvailableBars, *************** *** 328,435 **** } ! ! #region marketOpenEventHandler ! ! // protected virtual DateTime getBeginOfOscillatingPeriod(IndexBasedEndOfDayTimer timer) ! // { ! // DateTime beginOfOscillatingPeriod = ! // HistoricalEndOfDayTimer.GetMarketClose( ! // (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition-1]["quDate"] ); ! // return beginOfOscillatingPeriod; ! //// return new EndOfDayDateTime( (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition-1]["quDate"], ! //// EndOfDaySpecificTime.MarketClose ); ! // } ! // ! // private PVOPositionsStatus marketOpenEventHandler_openPositions_getStatus(IndexBasedEndOfDayTimer timer) ! // { ! // DateTime today = timer.GetCurrentDateTime(); ! // DateTime beginOfOscillatingPeriod = ! // this.getBeginOfOscillatingPeriod(timer); ! // PVOPositionsStatus currentStatus = ! // PVOPositionsStatus.InTheMiddle; ! // for(int i = 0; i<this.chosenPVOPositions.Length; i++) ! // { ! // if(this.chosenPVOPositions[i] != null) ! // currentStatus = ! // ((PVOPositions)this.chosenPVOPositions[i]).GetStatus(beginOfOscillatingPeriod, today, ! // this.benchmark.Ticker, this.historicalMarketValueProviderForInSample, ! // this.oversoldThresholdMAX, this.overboughtThresholdMAX); ! // if(currentStatus == PVOPositionsStatus.Oversold || ! // currentStatus == PVOPositionsStatus.Overbought ) ! // { ! // this.positionsForOutOfSample = (PVOPositions)this.chosenPVOPositions[i]; ! // i = this.chosenPVOPositions.Length;//exit from for ! // } ! // } ! // return currentStatus; ! // } ! // ! // protected void marketOpenEventHandler_openPositions(IndexBasedEndOfDayTimer timer) ! // { ! // PVOPositionsStatus pvoPositionsStatus = PVOPositionsStatus.InTheMiddle; ! // if(timer.CurrentDateArrayPosition >= 1) ! // pvoPositionsStatus = ! // this.marketOpenEventHandler_openPositions_getStatus(timer); ! // switch (pvoPositionsStatus) ! // { ! // case PVOPositionsStatus.Overbought: ! // { ! // #region manage Overbought case ! // this.positionsForOutOfSample.WeightedPositions.Reverse(); ! // try ! // { ! // AccountManager.OpenPositions( this.positionsForOutOfSample.WeightedPositions, ! // this.account ); ! // } ! // catch(Exception ex) ! // { ! // string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; ! // } ! // finally ! // { ! // this.positionsForOutOfSample.WeightedPositions.Reverse(); ! // } ! // #endregion ! // break; ! // } ! // case PVOPositionsStatus.Oversold: ! // { ! // AccountManager.OpenPositions( this.positionsForOutOfSample.WeightedPositions, ! // this.account ); ! // break; ! // } ! // case PVOPositionsStatus.InTheMiddle://that is ! // { //pvoPositionsForOutOfSample has not been set ! // ! // break; ! // } ! // default: ! // { ! // //it should never been reached ! // break; ! // } ! // } ! // } ! // ! // protected void marketOpenEventHandler( ! // Object sender , DateTime dateTime ) ! // { ! // if ( this.account.Portfolio.Count == 0 && ! // this.chosenPVOPositions != null && ! // this.optimalPositionsHaveBeenUpdated == true) ! // //portfolio is empty and optimization has ! // //been already successfully launched ! // { ! // try{ ! // this.marketOpenEventHandler_openPositions( (IndexBasedEndOfDayTimer)sender ); ! // } ! // catch(TickerNotExchangedException ex) ! // { ! // string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; ! // } ! // } ! // } ! ! #endregion private bool allTickersAreExchanged(DateTime dateTime, --- 341,370 ---- } ! private bool allTickersAreExchangedBeforeLastAvailableTime(DateTime fromDateTime, ! string[] tickers) ! { ! bool returnValue = true; ! try{ ! for( int i = 0; i < tickers.Length; i++ ) ! { ! Bars currentTickerBars = ! new Bars(tickers[i], fromDateTime, ! Time.GetDateTimeFromMerge(fromDateTime, ! this.openingTimesForAvailableBars[this.openingTimesForAvailableBars.Count-1]), ! 60); ! if( currentTickerBars.Rows.Count < 1 ) ! { ! returnValue = false; ! i = tickers.Length; //exit from for ! } ! } ! } ! catch(Exception ex){ ! string forBreakpoint = ex.Message; ! forBreakpoint = forBreakpoint + ""; ! returnValue = false; ! } ! return returnValue; ! } private bool allTickersAreExchanged(DateTime dateTime, *************** *** 459,466 **** private void newDateTimeEventHandler_closePositions(Time currentDailyTime) { ! if( this.account.Portfolio.Count > 0 && ! (this.lastEntryTime.AddMinutes(maxOpeningLengthInMinutes) == currentDailyTime || ! this.stopLossConditionReached || this.takeProfitConditionReached ) && ! allTickersAreExchanged( this.now(), AccountManager.GetTickersInOpenedPositions(this.account) ) ) { AccountManager.ClosePositions( this.account ); --- 394,407 ---- private void newDateTimeEventHandler_closePositions(Time currentDailyTime) { ! bool positionsHaveBeenOpenedEnough = ! (this.account.Portfolio.Count > 0 && ! this.lastEntryTime.AddMinutes(maxOpeningLengthInMinutes) <= currentDailyTime); ! bool isTimeToProfitOrToStopALoss = ! this.account.Portfolio.Count > 0 && ! (this.takeProfitConditionReached || this.stopLossConditionReached) && ! (this.lastProfitOrLossTime.AddMinutes(this.minutesFromLastLossOrProfitToWaitBeforeClosing) == currentDailyTime); ! ! if( (positionsHaveBeenOpenedEnough || isTimeToProfitOrToStopALoss ) && ! allTickersAreExchanged( this.now(), AccountManager.GetTickersInOpenedPositions(this.account) ) ) { AccountManager.ClosePositions( this.account ); *************** *** 480,484 **** timeForClose <= getLastEventTimeWithCachedBars() && this.allTickersAreExchanged( this.now(), this.positionsForOutOfSample.WeightedPositions.SignedTickers.Tickers ) && ! this.allTickersAreExchanged( dateTimeForClose, this.positionsForOutOfSample.WeightedPositions.SignedTickers.Tickers ) ) { switch (this.positionsForOutOfSampleStatus) --- 421,425 ---- timeForClose <= getLastEventTimeWithCachedBars() && this.allTickersAreExchanged( this.now(), this.positionsForOutOfSample.WeightedPositions.SignedTickers.Tickers ) && ! this.allTickersAreExchangedBeforeLastAvailableTime( dateTimeForClose, this.positionsForOutOfSample.WeightedPositions.SignedTickers.Tickers ) ) { switch (this.positionsForOutOfSampleStatus) *************** *** 537,541 **** } #endregion newDateTimeEventHandler_openPositions ! #region newDateTimeEventHandler_inefficiencyIsMovingBack private bool newDateTimeEventHandler_inefficiencyIsMovingBack(Time currentDailyTime) --- 478,482 ---- } #endregion newDateTimeEventHandler_openPositions ! #region newDateTimeEventHandler_inefficiencyIsMovingBack private bool newDateTimeEventHandler_inefficiencyIsMovingBack(Time currentDailyTime) *************** *** 549,553 **** PVOPositionsStatus.InTheMiddle; double coefficientForThresholdLevelComputationForMovingBackSignal = ! this.minutesFromLastInefficiencyTimeToWaitBeforeOpening/this.inefficiencyLengthInMinutes; if(this.positionsForOutOfSample != null) try{ --- 490,497 ---- PVOPositionsStatus.InTheMiddle; double coefficientForThresholdLevelComputationForMovingBackSignal = ! //(this.overboughtThreshold - this.takeProfit)/this.overboughtThreshold; ! this.minutesFromLastInefficiencyTimeToWaitBeforeOpening/ ! // this.inefficiencyLengthInMinutes; ! 100000; if(this.positionsForOutOfSample != null) try{ *************** *** 556,570 **** this.benchmark.Ticker, this.historicalMarketValueProviderForOutOfSample, this.oversoldThreshold * coefficientForThresholdLevelComputationForMovingBackSignal, ! 0.50, this.overboughtThreshold * coefficientForThresholdLevelComputationForMovingBackSignal, ! 0.50); ! }catch(Exception ex){string str = ex.ToString();} returnValue = ( (currentStatusForCurrentPositions == PVOPositionsStatus.Overbought && this.positionsForOutOfSampleStatus == PVOPositionsStatus.Oversold) || (currentStatusForCurrentPositions == PVOPositionsStatus.Oversold && this.positionsForOutOfSampleStatus == PVOPositionsStatus.Overbought) ); ! if( returnValue == false ) ! this.positionsForOutOfSample = null; //it forces a new research for inefficiencies return returnValue; } --- 500,518 ---- this.benchmark.Ticker, this.historicalMarketValueProviderForOutOfSample, this.oversoldThreshold * coefficientForThresholdLevelComputationForMovingBackSignal, ! this.oversoldThreshold, this.overboughtThreshold * coefficientForThresholdLevelComputationForMovingBackSignal, ! this.overboughtThreshold ); ! }catch{} returnValue = ( (currentStatusForCurrentPositions == PVOPositionsStatus.Overbought && this.positionsForOutOfSampleStatus == PVOPositionsStatus.Oversold) || (currentStatusForCurrentPositions == PVOPositionsStatus.Oversold && this.positionsForOutOfSampleStatus == PVOPositionsStatus.Overbought) ); ! if( (returnValue == false && ! currentDailyTime >= this.lastInefficiencyTime.AddMinutes(this.inefficiencyLengthInMinutes) ) || ! returnValue == true ) ! //positions are not moving back and the same n° of minutes as inefficiency length ! //has elapsed OR positions are moving back (the gap is closing) ! this.lastInefficiencyTime = new Time(0,0,0); //it forces a new research of an inefficiency return returnValue; } *************** *** 583,587 **** this.positionsForOutOfSampleStatus = PVOPositionsStatus.InTheMiddle; ! this.lastInefficiencyTime = new Time("00:00:00"); for(int i = 0; i<this.chosenPVOPositions.Length; i++) { --- 531,535 ---- this.positionsForOutOfSampleStatus = PVOPositionsStatus.InTheMiddle; ! //this.lastInefficiencyTime = new Time("00:00:00"); for(int i = 0; i<this.chosenPVOPositions.Length; i++) { *************** *** 607,615 **** #region newDateTimeEventHandler_updateStopLossAndTakeProfitConditions ! protected virtual void newDateTimeEventHandler_updateStopLossAndTakeProfitConditions() { //this.previousAccountValue has been set at opening positions this.stopLossConditionReached = false; this.takeProfitConditionReached = false; if(this.account.Portfolio.Count > 0) { --- 555,564 ---- #region newDateTimeEventHandler_updateStopLossAndTakeProfitConditions ! protected virtual void newDateTimeEventHandler_updateStopLossAndTakeProfitConditions(Time currentDailyTime) { //this.previousAccountValue has been set at opening positions this.stopLossConditionReached = false; this.takeProfitConditionReached = false; + this.lastProfitOrLossTime = new Time("00:00:00"); if(this.account.Portfolio.Count > 0) { *************** *** 623,627 **** { this.stopLossConditionReached = true; ! this.takeProfitConditionReached = false; } else if (!double.IsInfinity(portfolioGainOrLoss) && --- 572,576 ---- { this.stopLossConditionReached = true; ! this.lastProfitOrLossTime = currentDailyTime; } else if (!double.IsInfinity(portfolioGainOrLoss) && *************** *** 629,634 **** { - this.stopLossConditionReached = false; this.takeProfitConditionReached = true; } } --- 578,583 ---- { this.takeProfitConditionReached = true; + this.lastProfitOrLossTime = currentDailyTime; } } *************** *** 644,663 **** { Time currentTime = new Time( dateTime ); ! this.newDateTimeEventHandler_updateStopLossAndTakeProfitConditions(); this.newDateTimeEventHandler_closePositions(currentTime); ! ! if( currentTime < getLastEventTimeWithCachedBars() && currentTime >= ! getFirstEventTimeWithCachedBars().AddMinutes(inefficiencyLengthInMinutes) && ! this.chosenPVOPositions != null && this.positionsForOutOfSample == null ) ! //it's possible to compute inefficiency and optimization has been done and no inefficiency ! //has been found this.newDateTimeEventHandler_setPositionsAndStatus(currentTime); ! if( currentTime == ! this.lastInefficiencyTime.AddMinutes(this.minutesFromLastInefficiencyTimeToWaitBeforeOpening) && ! this.newDateTimeEventHandler_inefficiencyIsMovingBack(currentTime) ) ! //it's time for checking if inefficiency is moving back and the last inefficiency found is ! //moving back this.newDateTimeEventHandler_openPositions(currentTime); --- 593,614 ---- { Time currentTime = new Time( dateTime ); ! this.newDateTimeEventHandler_updateStopLossAndTakeProfitConditions(currentTime); this.newDateTimeEventHandler_closePositions(currentTime); ! if( this.account.Portfolio.Count == 0 && ! this.chosenPVOPositions != null && ! this.lastInefficiencyTime == new Time(0,0,0) && ! currentTime < getLastEventTimeWithCachedBars() && currentTime >= ! getFirstEventTimeWithCachedBars().AddMinutes(inefficiencyLengthInMinutes) ) ! //portfolio empty, optimization done, no inefficiency found, time OK this.newDateTimeEventHandler_setPositionsAndStatus(currentTime); ! if( this.account.Portfolio.Count == 0 && ! currentTime >= ! this.lastInefficiencyTime.AddMinutes(this.minutesFromLastInefficiencyTimeToWaitBeforeOpening) ! && ! this.newDateTimeEventHandler_inefficiencyIsMovingBack(currentTime) ! ) ! //it's time for starting checking if the last inefficiency found is moving back this.newDateTimeEventHandler_openPositions(currentTime); *************** *** 685,690 **** EligibleTickers eligibles = this.eligiblesSelector.GetEligibleTickers(history); ! this.updateReturnsManager(history.FirstDateTime, ! history.LastDateTime); if( ( this.eligiblesSelector is DummyEligibleSelector && this.inSampleChooser != null ) || --- 636,641 ---- EligibleTickers eligibles = this.eligiblesSelector.GetEligibleTickers(history); ! this.updateReturnsManager(Time.GetDateTimeFromMerge(history.FirstDateTime, this.openingTimesForAvailableBars[0]), ! Time.GetDateTimeFromMerge(history.LastDateTime, this.openingTimesForAvailableBars[this.openingTimesForAvailableBars.Count - 1])); if( ( this.eligiblesSelector is DummyEligibleSelector && this.inSampleChooser != null ) || *************** *** 695,704 **** this.updateTestingPositions_updateThresholds(); this.logOptimizationInfo(eligibles); - // this.optimalPositionsHaveBeenUpdated = true; } - // else - // { - // this.optimalPositionsHaveBeenUpdated = false; - // } } --- 646,650 ---- *************** *** 722,736 **** DateTime dateTime ) { - //OLD - numDaysBetweenEachOptimization --> market days - // if( this.account.Transactions.Count <= 1 || - // (this.numDaysElapsedSinceLastOptimization == - // this.numDaysBetweenEachOptimization) ) - //num days without optimization has elapsed or - //no transaction, except for adding cash, has been executed - //NEW - numDaysBetweenEachOptimization --> calendar days if ( this.optimalTestingPositionsAreToBeUpdated() ) { this.updateTestingPositions( dateTime ); - //sets tickers to be chosen next time this.lastOptimizationDateTime = this.now(); } --- 668,674 ---- *************** *** 744,752 **** protected virtual void updateReturnsManager(DateTime firstDateTime, ! DateTime lastDayDateTime) { ReturnIntervals returnIntervals = ! new DailyOpenToCloseIntervals( firstDateTime, lastDayDateTime, this.benchmark.Ticker ); if( this.inSampleChooser is PVOCorrelationChooser ) { --- 682,696 ---- protected virtual void updateReturnsManager(DateTime firstDateTime, ! DateTime lastDateTime) { ReturnIntervals returnIntervals = ! new DailyOpenToCloseIntervals( firstDateTime, lastDateTime, this.benchmark.Ticker ); + if(this.inSampleChooser is PVOIntradayCorrelationChooser) + returnIntervals = + new IntradayIntervals(firstDateTime, lastDateTime, + ((PVOIntradayCorrelationChooser)this.inSampleChooser).ReturnIntervalLengthInMinutes, + this.benchmark.Ticker); + if( this.inSampleChooser is PVOCorrelationChooser ) { *************** *** 754,779 **** { case IntervalsType.CloseToCloseIntervals: ! returnIntervals = new CloseToCloseIntervals(firstDateTime, lastDayDateTime, this.benchmark.Ticker, ((PVOCorrelationChooser)this.inSampleChooser).ReturnIntervalLength); break; case IntervalsType.OpenToOpenIntervals: ! returnIntervals = new OpenToOpenIntervals(firstDateTime, lastDayDateTime, this.benchmark.Ticker, ((PVOCorrelationChooser)this.inSampleChooser).ReturnIntervalLength); break; case IntervalsType.CloseToOpenIntervals: ! returnIntervals = new CloseToOpenIntervals(firstDateTime, lastDayDateTime, this.benchmark.Ticker); break; case IntervalsType.OpenToCloseIntervals: ! returnIntervals = new DailyOpenToCloseIntervals(firstDateTime, lastDayDateTime, this.benchmark.Ticker ); break; case IntervalsType.OpenToCloseCloseToOpenIntervals: returnIntervals = new OpenToCloseCloseToOpenIntervals( ! firstDateTime, lastDayDateTime, this.benchmark.Ticker); break; default: // it should never be reached ! returnIntervals = new DailyOpenToCloseIntervals(firstDateTime, lastDayDateTime, this.benchmark.Ticker ); break; --- 698,723 ---- { case IntervalsType.CloseToCloseIntervals: ! returnIntervals = new CloseToCloseIntervals(firstDateTime, lastDateTime, this.benchmark.Ticker, ((PVOCorrelationChooser)this.inSampleChooser).ReturnIntervalLength); break; case IntervalsType.OpenToOpenIntervals: ! returnIntervals = new OpenToOpenIntervals(firstDateTime, lastDateTime, this.benchmark.Ticker, ((PVOCorrelationChooser)this.inSampleChooser).ReturnIntervalLength); break; case IntervalsType.CloseToOpenIntervals: ! returnIntervals = new CloseToOpenIntervals(firstDateTime, lastDateTime, this.benchmark.Ticker); break; case IntervalsType.OpenToCloseIntervals: ! returnIntervals = new DailyOpenToCloseIntervals(firstDateTime, lastDateTime, this.benchmark.Ticker ); break; case IntervalsType.OpenToCloseCloseToOpenIntervals: returnIntervals = new OpenToCloseCloseToOpenIntervals( ! firstDateTime, lastDateTime, this.benchmark.Ticker); break; default: // it should never be reached ! returnIntervals = new DailyOpenToCloseIntervals(firstDateTime, lastDateTime, this.benchmark.Ticker ); break; *************** *** 783,787 **** this.returnsManager = new ReturnsManager( returnIntervals , this.historicalMarketValueProviderForInSample); - } --- 727,730 ---- Index: PVOStrategyIntradayMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOStrategyIntradayMain.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PVOStrategyIntradayMain.cs 12 Jan 2009 18:11:01 -0000 1.3 --- PVOStrategyIntradayMain.cs 13 Mar 2009 15:12:01 -0000 1.4 *************** *** 64,70 **** private HistoricalMarketValueProvider historicalMarketValueProviderForInSample; private HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample; private double inefficiencyLengthInMinutes; private double maxOpeningLengthInMinutes; ! private double minutesFromLastInefficiencyTimeToWaitBeforeOpening; private Timer timerForBackTester; private DateTime firstDateTime; --- 64,73 ---- private HistoricalMarketValueProvider historicalMarketValueProviderForInSample; private HistoricalMarketValueProvider historicalMarketValueProviderForOutOfSample; + private HistoricalMarketValueProvider historicalMarketValueProviderForTheBackTester; private double inefficiencyLengthInMinutes; private double maxOpeningLengthInMinutes; ! private double minutesFromLastInefficiencyToWaitBeforeOpening; ! private double minutesFromLastLossOrProfitToWaitBeforeClosing; ! private int stepInMinutesForTimer; private Timer timerForBackTester; private DateTime firstDateTime; *************** *** 74,91 **** public PVOStrategyIntradayMain() { ! //this.benchmark = new Benchmark( "^GSPC" ); ! this.inefficiencyLengthInMinutes = 120; ! this.minutesFromLastInefficiencyTimeToWaitBeforeOpening = 30; ! this.maxOpeningLengthInMinutes = 120; ! ! this.firstDateTime = new DateTime( 2006 , 1 , 1 ); ! this.lastDateTime = new DateTime( 2007 , 12, 31 ); this.intervalFrameInSeconds = 60; ! this.benchmark = new Benchmark( "MSFT" ); ! this.historicalMarketValueProviderForInSample = ! new HistoricalAdjustedQuoteProvider(); this.historicalMarketValueProviderForOutOfSample = this.getHistoricalBarProvider(); ! this.timerForBackTester = new IndexBasedHistoricalTimer(this.benchmark.Ticker, this.firstDateTime, --- 77,109 ---- public PVOStrategyIntradayMain() { ! this.inefficiencyLengthInMinutes = 30; ! this.maxOpeningLengthInMinutes = 240; ! this.minutesFromLastInefficiencyToWaitBeforeOpening = 1; ! this.minutesFromLastLossOrProfitToWaitBeforeClosing = 0; ! this.stepInMinutesForTimer = 1; this.intervalFrameInSeconds = 60; ! ! this.firstDateTime = new DateTime( 2006 , 2 , 1 ); ! this.lastDateTime = new DateTime( 2006 , 12, 31 ); ! ! this.benchmark = new Benchmark( "CCE" ); ! this.historicalMarketValueProviderForOutOfSample = this.getHistoricalBarProvider(); ! ! this.historicalMarketValueProviderForInSample = ! // new HistoricalAdjustedQuoteProvider(); ! new HistoricalBarInterpolatingProvider( this.getBarCache() ); ! ! this.historicalMarketValueProviderForTheBackTester = ! // new HistoricalBarProvider( ! // new SimpleBarCache( intervalFrameInSeconds, ! // BarComponent.Open ) ); ! // new HistoricalBarProvider( ! // new DailyBarCache( intervalFrameInSeconds, ! // this.getDailyTimes() ) ); ! this.historicalMarketValueProviderForOutOfSample; ! ! this.timerForBackTester = new IndexBasedHistoricalTimer(this.benchmark.Ticker, this.firstDateTime, *************** *** 93,104 **** this.getDailyTimes(), this.intervalFrameInSeconds); - // definition for the Fitness Evaluator - // IEquityEvaluator equityEvaluator = new SharpeRatio(); } protected override IEligiblesSelector getEligiblesSelector() { ! int maxNumberOfMostLiquidTickersToBeChosen = 100; ! int maxNumberOfEligiblesToBeChosen = 50; string tickersGroupId = "SP500"; --- 111,120 ---- this.getDailyTimes(), this.intervalFrameInSeconds); } protected override IEligiblesSelector getEligiblesSelector() { ! ! int maxNumberOfEligiblesToBeChosen = 100; string tickersGroupId = "SP500"; *************** *** 106,113 **** bool temporizedGroup = true; int numDaysForAverageRawOpenPriceComputation = 10; ! double minPrice = 25.0; ! double maxPrice = 500.0; ! ! int numDaysForVolatility = 15; // IEligiblesSelector eligiblesSelector = --- 122,131 ---- bool temporizedGroup = true; int numDaysForAverageRawOpenPriceComputation = 10; ! double minPrice = 30; ! double maxPrice = 300; ! ! int maxNumberOfMostLiquidTickersToBeChosen = 150; ! int numDaysForVolatility = 10; ! int minimumNumberOfMinutelyBarsForEachDayForInSample = 20; // IEligiblesSelector eligiblesSelector = *************** *** 119,130 **** // this.benchmark.Ticker ); // LAST GOOD IEligiblesSelector eligiblesSelector = ! new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( ! tickersGroupId , temporizedGroup , maxNumberOfEligiblesToBeChosen , ! maxNumberOfMostLiquidTickersToBeChosen , ! numDaysForAverageRawOpenPriceComputation , ! numDaysForVolatility , ! minPrice , maxPrice ); // IEligiblesSelector eligiblesSelector = // new ByPriceMostLiquidAlwaysQuoted( --- 137,157 ---- // this.benchmark.Ticker ); // LAST GOOD + // IEligiblesSelector eligiblesSelector = + // new ByPriceMostLiquidLessVolatileOTCAlwaysQuoted( + // tickersGroupId , temporizedGroup , + // maxNumberOfEligiblesToBeChosen , + // maxNumberOfMostLiquidTickersToBeChosen , + // numDaysForAverageRawOpenPriceComputation , + // numDaysForVolatility , + // minPrice , maxPrice ); + IEligiblesSelector eligiblesSelector = ! new ByPriceMostLiquidAlwaysIntradayQuoted( ! tickersGroupId , this.benchmark, temporizedGroup , maxNumberOfEligiblesToBeChosen , ! numDaysForAverageRawOpenPriceComputation , ! minPrice , maxPrice, ! minimumNumberOfMinutelyBarsForEachDayForInSample ); ! // IEligiblesSelector eligiblesSelector = // new ByPriceMostLiquidAlwaysQuoted( *************** *** 161,168 **** double maxCorrelationAllowed = 0.96; int numberOfBestTestingPositionsToBeReturned = 50; ! // numberOfBestTestingPositionsToBeReturned = 50; bool balancedWeightsOnVolatilityBase = true; ! float minimumAbsoluteReturnValue = 0.000001f; float maximumAbsoluteReturnValue = 100000f; //correlation is computed only for returns //between minimum and maximum --- 188,196 ---- double maxCorrelationAllowed = 0.96; int numberOfBestTestingPositionsToBeReturned = 50; ! numberOfBestTestingPositionsToBeReturned = 50; bool balancedWeightsOnVolatilityBase = true; ! float minimumAbsoluteReturnValue = 0.00005f; float maximumAbsoluteReturnValue = 100000f; + int returnIntervalLengthInMinutesForCorrelationProvider = 120; //correlation is computed only for returns //between minimum and maximum *************** *** 176,191 **** // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); IInSampleChooser inSampleChooser = ! new PVO_CTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! 1 , maxCorrelationAllowed , balancedWeightsOnVolatilityBase, minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); // //office // inSampleChooser = // new PVOChooserFromSavedBackTestLog( ! // @"C:\Utente\MarcoVarie\Vari\qP\LogArchive\2008_08_06_16_57_34_PVO_OTC_from_2003_06_01_to_2008_04_28_annlRtrn_3,34_maxDD_11,36\2008_08_06_16_57_34_PVO_OTC_from_2003_06_01_to_2008_04_28_annlRtrn_3,34_maxDD_11,36.qpL", // numberOfBestTestingPositionsToBeReturned); //home // inSampleChooser = // new PVOChooserFromSavedBackTestLog( ! // @"C:\Utente\MarcoVarie\Vari\qP\LogArchive\2009_01_07_18_51_09_PVOIntraday_from_2006_01_01_to_2007_12_31_annlRtrn_15.67_maxDD_2.91\2009_01_07_18_51_09_PVOIntraday_from_2006_01_01_to_2007_12_31_annlRtrn_15.67_maxDD_2.91.qpL", // numberOfBestTestingPositionsToBeReturned); return inSampleChooser; --- 204,224 ---- // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); IInSampleChooser inSampleChooser = ! // new PVO_CTCCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! // 1 , maxCorrelationAllowed , balancedWeightsOnVolatilityBase, ! // minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); ! new PVOIntradayCorrelationChooser(numberOfBestTestingPositionsToBeReturned, ! returnIntervalLengthInMinutesForCorrelationProvider , ! maxCorrelationAllowed , balancedWeightsOnVolatilityBase, minimumAbsoluteReturnValue , maximumAbsoluteReturnValue, this.benchmark.Ticker); + // //office // inSampleChooser = // new PVOChooserFromSavedBackTestLog( ! // @"C:\Utente\MarcoVarie\Vari\qP\LogArchive\2009_01_05_13_40_28_PVOIntraday_from_2006_01_01_to_2007_12_31_annlRtrn_17,84_maxDD_4,52\2009_01_05_13_40_28_PVOIntraday_from_2006_01_01_to_2007_12_31_annlRtrn_17,84_maxDD_4,52.qpL", // numberOfBestTestingPositionsToBeReturned); //home // inSampleChooser = // new PVOChooserFromSavedBackTestLog( ! // @"C:\Utente\MarcoVarie\Vari\qP\LogArchive\2009_02_17_23_17_03_PVOIntraday_from_2006_01_01_to_2007_12_31_annlRtrn_24.44_maxDD_3.05\2009_02_17_23_17_03_PVOIntraday_from_2006_01_01_to_2007_12_31_annlRtrn_24.44_maxDD_3.05.qpL", // numberOfBestTestingPositionsToBeReturned); return inSampleChooser; *************** *** 195,207 **** { //int inSampleDays = 90; ! int inSampleDays = 120; ! int numDaysBetweenEachOptimization = 5; int minNumOfEligiblesForValidOptimization = 20; ! double oversoldThreshold = 0.0055; ! double overboughtThreshold = 0.0055; ! double oversoldThresholdMAX = 0.015; ! double overboughtThresholdMAX = 0.015; ! double stopLoss = 0.01; ! double takeProfit = 0.0045; IStrategyForBacktester strategyForBacktester --- 228,240 ---- { //int inSampleDays = 90; ! int inSampleDays = 30; ! int numDaysBetweenEachOptimization = 4; int minNumOfEligiblesForValidOptimization = 20; ! double oversoldThreshold = 0.005;//0.006 ! double overboughtThreshold = 0.005;//0.006 ! double oversoldThresholdMAX = 0.025; ! double overboughtThresholdMAX = 0.025; ! double stopLoss = 0.02; ! double takeProfit = 0.0025;//0.0045 IStrategyForBacktester strategyForBacktester *************** *** 217,222 **** historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! inefficiencyLengthInMinutes , ! this.minutesFromLastInefficiencyTimeToWaitBeforeOpening, maxOpeningLengthInMinutes, this.getDailyTimes(), stopLoss , takeProfit ); --- 250,255 ---- historicalMarketValueProviderForInSample, historicalMarketValueProviderForOutOfSample, ! inefficiencyLengthInMinutes , minutesFromLastInefficiencyToWaitBeforeOpening, ! this.minutesFromLastLossOrProfitToWaitBeforeClosing, maxOpeningLengthInMinutes, this.getDailyTimes(), stopLoss , takeProfit ); *************** *** 228,246 **** private List<Time> getDailyTimes() { ! List<Time> dailyTimes = new List<Time>(); ! dailyTimes.Add( new Time("10:00:00") ); ! dailyTimes.Add( new Time("10:30:00") ); ! dailyTimes.Add( new Time("11:00:00") ); ! dailyTimes.Add( new Time("11:30:00") ); ! dailyTimes.Add( new Time("12:00:00") ); ! dailyTimes.Add( new Time("12:30:00") ); ! dailyTimes.Add( new Time("13:00:00") ); ! dailyTimes.Add( new Time("13:30:00") ); ! dailyTimes.Add(new Time("14:00:00") ); ! dailyTimes.Add(new Time("14:30:00") ); ! dailyTimes.Add(new Time("15:00:00") ); ! dailyTimes.Add(new Time("15:30:00") ); ! dailyTimes.Add(new Time("16:00:00") ); ! return dailyTimes; } private IBarCache getBarCache() --- 261,267 ---- private List<Time> getDailyTimes() { ! return Time.GetIntermediateTimes(new Time("09:45:00"), ! new Time("16:00:00"), ! this.stepInMinutesForTimer); } private IBarCache getBarCache() *************** *** 270,283 **** // new InteractiveBrokerAccountProvider(fixedPercentageSlippage); double cashToStart = 25000; ! double maxRunningHours = 5; ! HistoricalMarketValueProvider quoteProviderForBackTester = ! this.historicalMarketValueProviderForOutOfSample; ! // quoteProviderForBackTester = ! // new HistoricalRawQuoteProvider(); EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( backTestId , this.timerForBackTester, this.strategyForBacktester , ! quoteProviderForBackTester , accountProvider , firstDateTime , lastDateTime , this.benchmark , cashToStart , maxRunningHours ); --- 291,300 ---- // new InteractiveBrokerAccountProvider(fixedPercentageSlippage); double cashToStart = 25000; ! double maxRunningHours = 15; EndOfDayStrategyBackTester endOfDayStrategyBackTester = new EndOfDayStrategyBackTester( backTestId , this.timerForBackTester, this.strategyForBacktester , ! this.historicalMarketValueProviderForTheBackTester , accountProvider , firstDateTime , lastDateTime , this.benchmark , cashToStart , maxRunningHours ); |