Search in sources :

Example 6 with FixedRule

use of org.ta4j.core.trading.rules.FixedRule in project ta4j by ta4j.

the class TimeSeriesTest method setUp.

// it is purposed to test the deprecated sub series creation
@SuppressWarnings("deprecation")
@Before
public void setUp() {
    bars = new LinkedList<>();
    bars.add(new MockBar(ZonedDateTime.of(2014, 6, 13, 0, 0, 0, 0, ZoneId.systemDefault()), 1d));
    bars.add(new MockBar(ZonedDateTime.of(2014, 6, 14, 0, 0, 0, 0, ZoneId.systemDefault()), 2d));
    bars.add(new MockBar(ZonedDateTime.of(2014, 6, 15, 0, 0, 0, 0, ZoneId.systemDefault()), 3d));
    bars.add(new MockBar(ZonedDateTime.of(2014, 6, 20, 0, 0, 0, 0, ZoneId.systemDefault()), 4d));
    bars.add(new MockBar(ZonedDateTime.of(2014, 6, 25, 0, 0, 0, 0, ZoneId.systemDefault()), 5d));
    bars.add(new MockBar(ZonedDateTime.of(2014, 6, 30, 0, 0, 0, 0, ZoneId.systemDefault()), 6d));
    defaultName = "Series Name";
    defaultSeries = new BaseTimeSeries(defaultName, bars);
    constrainedSeries = new BaseTimeSeries(defaultSeries, 2, 4);
    emptySeries = new BaseTimeSeries();
    Strategy strategy = new BaseStrategy(new FixedRule(0, 2, 3, 6), new FixedRule(1, 4, 7, 8));
    // Strategy would need a real test class
    strategy.setUnstablePeriod(2);
}
Also used : MockBar(org.ta4j.core.mocks.MockBar) FixedRule(org.ta4j.core.trading.rules.FixedRule) Before(org.junit.Before)

Aggregations

FixedRule (org.ta4j.core.trading.rules.FixedRule)6 Before (org.junit.Before)3 Test (org.junit.Test)3 ZonedDateTime (java.time.ZonedDateTime)2 MockTimeSeries (org.ta4j.core.mocks.MockTimeSeries)2 DateTimeFormatter (java.time.format.DateTimeFormatter)1 BaseStrategy (org.ta4j.core.BaseStrategy)1 Strategy (org.ta4j.core.Strategy)1 MockBar (org.ta4j.core.mocks.MockBar)1