|
From: Márcio V. d. S. <mv...@us...> - 2007-08-23 12:51:16
|
Update of /cvsroot/tail/Tail/src/test/net/sf/tail/analysis In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv13475/src/test/net/sf/tail/analysis Modified Files: StockAnalysisTest.java Log Message: Index: StockAnalysisTest.java =================================================================== RCS file: /cvsroot/tail/Tail/src/test/net/sf/tail/analysis/StockAnalysisTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StockAnalysisTest.java 23 Aug 2007 12:47:06 -0000 1.2 --- StockAnalysisTest.java 23 Aug 2007 12:51:12 -0000 1.3 *************** *** 30,91 **** public class StockAnalysisTest { ! private Stock stock; private TotalProfitCriterion applyedCriterion; private StockAnalysis stockAnalysis; private BestStrategyEvaluator evaluator; private SlicerByTimePeriod slicer; private HashSet<Strategy> strategies; private Report report; private WalkForward walker; @Before public void setUp() throws Exception { ! this.stock = new Stock("Teste","Teste"); this.applyedCriterion = new TotalProfitCriterion(); Period period = new Period().withYears(1); DateTime date = new DateTime(); ! TimeSeries series = new SampleTimeSeries( ! date.withDate(2000,1,1), date.withDate(2000,2,1), date.withDate(2000,3,1), ! date.withDate(2001,1,1), date.withDate(2001,2,1), date.withDate(2001,12,12), ! date.withDate(2002,1,1), date.withDate(2002,2,1), date.withDate(2002,3,1), date.withDate(2002,5,1), ! date.withDate(2003,3,1) ); slicer = new SlicerByTimePeriod(series, period, date.withYear(2000).withMonthOfYear(7), SlicerType.REGULAR); Runner runner = new HistoryRunner(OperationType.BUY); evaluator = new BestStrategyEvaluator(runner); ! ! Operation[] enter = new Operation[] { new Operation(0, OperationType.BUY), ! null, ! new Operation(2, OperationType.BUY), ! null, ! null, ! null, ! null, ! null, ! null, ! null, ! null ! }; ! Operation[] exit = new Operation[] { null, ! new Operation(1, OperationType.SELL), ! null, ! null, ! null, ! new Operation(5, OperationType.SELL), ! null, ! null, ! null, ! null, ! null ! }; ! strategies = new HashSet<Strategy>(); ! strategies.add(new FakeStrategy(enter,exit)); ! walker = new WalkForward(evaluator); report = walker.walk(strategies, slicer, applyedCriterion); ! ! this.stockAnalysis = new StockAnalysis(stock,applyedCriterion,slicer, evaluator); } --- 30,77 ---- public class StockAnalysisTest { ! private Stock stock; + private TotalProfitCriterion applyedCriterion; + private StockAnalysis stockAnalysis; + private BestStrategyEvaluator evaluator; + private SlicerByTimePeriod slicer; + private HashSet<Strategy> strategies; + private Report report; + private WalkForward walker; @Before public void setUp() throws Exception { ! this.stock = new Stock("Teste", "Teste"); this.applyedCriterion = new TotalProfitCriterion(); Period period = new Period().withYears(1); DateTime date = new DateTime(); ! TimeSeries series = new SampleTimeSeries(date.withDate(2000, 1, 1), date.withDate(2000, 2, 1), date.withDate( ! 2000, 3, 1), date.withDate(2001, 1, 1), date.withDate(2001, 2, 1), date.withDate(2001, 12, 12), date ! .withDate(2002, 1, 1), date.withDate(2002, 2, 1), date.withDate(2002, 3, 1), date.withDate(2002, 5, 1), ! date.withDate(2003, 3, 1)); slicer = new SlicerByTimePeriod(series, period, date.withYear(2000).withMonthOfYear(7), SlicerType.REGULAR); Runner runner = new HistoryRunner(OperationType.BUY); evaluator = new BestStrategyEvaluator(runner); ! ! Operation[] enter = new Operation[] { new Operation(0, OperationType.BUY), null, ! new Operation(2, OperationType.BUY), null, null, null, null, null, null, null, null }; ! Operation[] exit = new Operation[] { null, new Operation(1, OperationType.SELL), null, null, null, ! new Operation(5, OperationType.SELL), null, null, null, null, null }; ! strategies = new HashSet<Strategy>(); ! strategies.add(new FakeStrategy(enter, exit)); ! walker = new WalkForward(evaluator); report = walker.walk(strategies, slicer, applyedCriterion); ! ! this.stockAnalysis = new StockAnalysis(stock, applyedCriterion, slicer, evaluator); } *************** *** 129,133 **** @Test public void testGetReports() { ! } --- 115,119 ---- @Test public void testGetReports() { ! } |