Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9077/b7_Scripts/TickerSelectionTesting
Modified Files:
EndOfDayTimerHandlerCTO.cs
Log Message:
Updated Handler for efficient open to close portfolio: now selection of tickers minimizes commission amount.
Index: EndOfDayTimerHandlerCTO.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TickerSelectionTesting/EndOfDayTimerHandlerCTO.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** EndOfDayTimerHandlerCTO.cs 23 Mar 2005 21:35:32 -0000 1.5
--- EndOfDayTimerHandlerCTO.cs 30 Mar 2005 16:07:28 -0000 1.6
***************
*** 59,62 ****
--- 59,68 ----
private string benchmark;
+ //these two values have to be updated during
+ //backtest, for minimizing commission amount,
+ //according to broker's commission scheme
+ private double minPriceForMinimumCommission = 0;
+ private double maxPriceForMinimumCommission = 200;
+
public int NumberOfEligibleTickers
***************
*** 179,183 ****
new SelectorByAverageRawOpenPrice(this.tickerGroupID, false,
currentDate.AddDays(-this.numDaysForLiquidity), currentDate,
! this.numberOfEligibleTickers, 25, 35, 0, 0.5);
DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers();
SelectorByLiquidity mostLiquid = new SelectorByLiquidity(tickersByPrice, false,
--- 185,190 ----
new SelectorByAverageRawOpenPrice(this.tickerGroupID, false,
currentDate.AddDays(-this.numDaysForLiquidity), currentDate,
! this.numberOfEligibleTickers, this.minPriceForMinimumCommission,
! this.maxPriceForMinimumCommission, 0, 1.5);
DataTable tickersByPrice = selectorByOpenPrice.GetTableOfSelectedTickers();
SelectorByLiquidity mostLiquid = new SelectorByLiquidity(tickersByPrice, false,
***************
*** 216,219 ****
--- 223,233 ----
}
+ private void oneHourAfterMarketCloseEventHandler_updatePrices()
+ {
+ //min price for minimizing commission amount
+ //according to IB Broker's commission scheme
+ this.minPriceForMinimumCommission = this.account.CashAmount/(this.numberOfTickersToBeChosen*100);
+ }
+
/// <summary>
/// Handles a "One hour after market close" event.
***************
*** 224,227 ****
--- 238,242 ----
Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs )
{
+ this.oneHourAfterMarketCloseEventHandler_updatePrices();
this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime);
//sets tickers to be chosen next Market Open event
|