[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/Report
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-09-29 21:21:22
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18335/ReportDebugger Modified Files: WFMultiOneRankDebugEndOfDayTimerHandler.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: WFMultiOneRankDebugEndOfDayTimerHandler.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardMultiOneRank/ReportDebugger/WFMultiOneRankDebugEndOfDayTimerHandler.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WFMultiOneRankDebugEndOfDayTimerHandler.cs 27 Nov 2005 00:04:08 -0000 1.2 --- WFMultiOneRankDebugEndOfDayTimerHandler.cs 29 Sep 2008 21:20:55 -0000 1.3 *************** *** 3,7 **** WFMultiOneRankDebugEndOfDayTimerHandler.cs ! Copyright (C) 2003 Glauco Siliprandi --- 3,7 ---- WFMultiOneRankDebugEndOfDayTimerHandler.cs ! Copyright (C) 2003 Glauco Siliprandi *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 35,39 **** /// Strategy to debug the in sample optimization /// </summary> ! public class WFMultiOneRankDebugEndOfDayTimerHandler { private Account account; --- 35,40 ---- /// Strategy to debug the in sample optimization /// </summary> ! public class WFMultiOneRankDebugEndOfDayTimerHandler : ! QuantProject.Business.Strategies.EndOfDayTimerHandler { private Account account; *************** *** 46,49 **** --- 47,51 ---- this.signedTickers = signedTickers; } + #region FiveMinutesBeforeMarketCloseEventHandler private string getTicker( string signedTicker ) *************** *** 75,79 **** this.account.ClosePosition( ticker ); } ! private void fiveMinutesBeforeMarketCloseEventHandler_closePositions() { ArrayList tickers = new ArrayList(); --- 77,81 ---- this.account.ClosePosition( ticker ); } ! private void marketCloseEventHandler_closePositions() { ArrayList tickers = new ArrayList(); *************** *** 90,100 **** double todayMarketValueAtClose = this.account.DataStreamer.GetCurrentBid( ticker ); ! EndOfDayDateTime yesterdayAtClose = new ! EndOfDayDateTime( ! this.account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , ! EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , yesterdayAtClose ); double returnForLongPosition = ( todayMarketValueAtClose / yesterdayMarketValueAtClose ) - 1; --- 92,104 ---- double todayMarketValueAtClose = this.account.DataStreamer.GetCurrentBid( ticker ); ! DateTime yesterdayAtClose = ! HistoricalEndOfDayTimer.GetMarketClose( ! this.account.Timer.GetCurrentDateTime().AddDays( - 1 ) ); ! // new EndOfDayDateTime( ! // this.account.EndOfDayTimer.GetCurrentTime().DateTime.AddDays( - 1 ) , ! // EndOfDaySpecificTime.MarketClose ); double yesterdayMarketValueAtClose = historicalAdjustedQuoteProvider.GetMarketValue( ! ticker , yesterdayAtClose ); double returnForLongPosition = ( todayMarketValueAtClose / yesterdayMarketValueAtClose ) - 1; *************** *** 126,132 **** OrderType orderType = this.getOrderType( signedTicker ); bool returnValue = ( ( ( orderType == ! OrderType.MarketBuy ) && ( positionType == PositionType.Short ) ) || ! ( orderType == OrderType.MarketSellShort ) && ! ( positionType == PositionType.Long ) ); return returnValue; } --- 130,136 ---- OrderType orderType = this.getOrderType( signedTicker ); bool returnValue = ( ( ( orderType == ! OrderType.MarketBuy ) && ( positionType == PositionType.Short ) ) || ! ( orderType == OrderType.MarketSellShort ) && ! ( positionType == PositionType.Long ) ); return returnValue; } *************** *** 134,138 **** { return this.isCurrentlyReversed( this.signedTickers[ 0 ] ); ! } private long getQuantity( string ticker ) { --- 138,142 ---- { return this.isCurrentlyReversed( this.signedTickers[ 0 ] ); ! } private long getQuantity( string ticker ) { *************** *** 150,154 **** long quantity = this.getQuantity( ticker ); Order order = new Order( orderType , new Instrument( ticker ) , ! quantity ); this.account.AddOrder( order ); } --- 154,158 ---- long quantity = this.getQuantity( ticker ); Order order = new Order( orderType , new Instrument( ticker ) , ! quantity ); this.account.AddOrder( order ); } *************** *** 157,161 **** { this.openPosition( this.getTicker( signedTicker ) , ! this.getOrderType( signedTicker ) ); } private void fiveMinutesBeforeMarketCloseEventHandler_openReversePosition( --- 161,165 ---- { this.openPosition( this.getTicker( signedTicker ) , ! this.getOrderType( signedTicker ) ); } private void fiveMinutesBeforeMarketCloseEventHandler_openReversePosition( *************** *** 175,179 **** signedTicker ); } ! private void fiveMinutesBeforeMarketCloseEventHandler_openPositions() { // this.chosenTickers.SetTickers( this.bestPerformingTickers , this.account ); --- 179,183 ---- signedTicker ); } ! private void marketCloseEventHandler_openPositions() { // this.chosenTickers.SetTickers( this.bestPerformingTickers , this.account ); *************** *** 182,209 **** signedTicker ); } ! private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() { bool returnValue = ( this.account.Portfolio.Count > 0 ) && ( ( this.isLinearCombinationTodayValueHigherThanYesterday() && ! this.isCurrentlyReversed() ) || ! ( !this.isLinearCombinationTodayValueHigherThanYesterday() && ! !this.isCurrentlyReversed() ) ); return returnValue; } ! private bool fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() { bool returnValue = ( this.account.Portfolio.Count == 0 ); return returnValue; } ! public void FiveMinutesBeforeMarketCloseEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { ! if ( this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeClosed() ) ! this.fiveMinutesBeforeMarketCloseEventHandler_closePositions(); ! if ( this.fiveMinutesBeforeMarketCloseEventHandler_arePositionsToBeOpened() ) ! fiveMinutesBeforeMarketCloseEventHandler_openPositions(); } #endregion } } --- 186,225 ---- signedTicker ); } ! private bool marketCloseEventHandler_arePositionsToBeClosed() { bool returnValue = ( this.account.Portfolio.Count > 0 ) && ( ( this.isLinearCombinationTodayValueHigherThanYesterday() && ! this.isCurrentlyReversed() ) || ! ( !this.isLinearCombinationTodayValueHigherThanYesterday() && ! !this.isCurrentlyReversed() ) ); return returnValue; } ! private bool marketCloseEventHandler_arePositionsToBeOpened() { bool returnValue = ( this.account.Portfolio.Count == 0 ); return returnValue; } ! protected override void marketCloseEventHandler( ! Object sender , DateTime dateTime ) { ! if ( this.marketCloseEventHandler_arePositionsToBeClosed() ) ! this.marketCloseEventHandler_closePositions(); ! if ( this.marketCloseEventHandler_arePositionsToBeOpened() ) ! marketCloseEventHandler_openPositions(); } #endregion + protected override void marketOpenEventHandler( + Object sender , DateTime dateTime ) + { + ; + } + + protected override void oneHourAfterMarketCloseEventHandler( + Object sender , DateTime dateTime ) + { + ; + } + } } |