Package com.collective2.signalEntry.adapter

Examples of com.collective2.signalEntry.adapter.DynamicSimulationAdapter.tick()


        assertEquals(10, portfolio.position("msft").quantity().intValue());

        //confirm that a price below target will not trigger
        dataProvider = dataProvider.incTime(timeStep,new BigDecimal("119"));
        simulationAdapter.tick(dataProvider,sentryService);

        assertEquals(10, portfolio.position("msft").quantity().intValue());

        final Set<Integer> pendingSignalIdSet = new HashSet<Integer>();
        sentryService.sendAllSignalsRequest().visitC2Elements(new C2ElementVisitor() {
View Full Code Here


        long time = 100000l;
        BigDecimal fixedPrice = new BigDecimal("80.43");

        DynamicSimulationMockDataProvider dataProvider = new DynamicSimulationMockDataProvider(time,fixedPrice,fixedPrice,fixedPrice,fixedPrice,time+timeStep);

        simulationAdapter.tick(dataProvider,sentryService);

        Number buyPower = sentryService.buyPower(); // 10000 - ((10 * 80.43)+10) = 10000-814.30
        assertEquals(9185.7d,buyPower.doubleValue(),DELTA);

        Number systemEquity = sentryService.systemEquity(); //10 * 80.43 = 804.30
View Full Code Here

        long time = 100000l;
        BigDecimal fixedPrice = new BigDecimal("80.43");

        DynamicSimulationMockDataProvider dataProvider = new DynamicSimulationMockDataProvider(time,fixedPrice,fixedPrice,fixedPrice,fixedPrice,time+timeStep);

        simulationAdapter.tick(dataProvider,sentryService);

        Number buyPower = sentryService.buyPower(); // 10000 - ((10 * 80.43)+10) = 10000-814.30
        assertEquals(9185.7d,buyPower.doubleValue(),DELTA);

        Number systemEquity = sentryService.systemEquity(); //10 * 80.43 = 804.30
View Full Code Here

                //get data provider for the next time period
                DataProvider data = dataIterator.next();

                //first, send the data for this time period to the simulator
                adapter.tick(data, entryService); //multiple ticks can be sent for finer granularity

                //second use that data for building up your own signals
                mySignalGenerator(data, entryService);

            }
View Full Code Here

        BigDecimal lowPrice = new BigDecimal("80");
        BigDecimal highPrice = new BigDecimal("100");
        DynamicSimulationMockDataProvider dataProvider = new DynamicSimulationMockDataProvider(
                openTime,lowPrice,highPrice,lowPrice,highPrice,closeTime);

        simulationAdapter.tick(dataProvider, sentryService);

        assertEquals(10, portfolio.position("msft").quantity().intValue());

        dataProvider = dataProvider.incTime(timeStep, new BigDecimal("22"));
        simulationAdapter.tick(dataProvider, sentryService);
View Full Code Here

        simulationAdapter.tick(dataProvider, sentryService);

        assertEquals(10, portfolio.position("msft").quantity().intValue());

        dataProvider = dataProvider.incTime(timeStep, new BigDecimal("22"));
        simulationAdapter.tick(dataProvider, sentryService);

        assertEquals(10, portfolio.position("msft").quantity().intValue());

        dataProvider = dataProvider.incTime(timeStep,new BigDecimal("10"));
        simulationAdapter.tick(dataProvider, sentryService);
View Full Code Here

        simulationAdapter.tick(dataProvider, sentryService);

        assertEquals(10, portfolio.position("msft").quantity().intValue());

        dataProvider = dataProvider.incTime(timeStep,new BigDecimal("10"));
        simulationAdapter.tick(dataProvider, sentryService);


        simulationAdapter.awaitGainListeners();

        //results
View Full Code Here

        Integer signalId = openResponse.getInteger(C2Element.ElementSignalId);

        assertEquals(0,signalId.intValue());


        simulationAdapter.tick(dataProvider,sentryService);

        HashSet<Integer> pending = sentryService.sendAllSignalsRequest()
                                                   .collectIntegers(new HashSet<Integer>(),
                                                                    C2Element.ElementSignalId);
View Full Code Here

        //can not tick and transmit at same moment in order to keep simulator repeatable
        synchronized(lock) {
               //look at ordered list of signals for each system and do all those older than time now.
            this.time = dataProvider.endingTime();
            system.tick(time, dataProvider);
            lastTickDataProvider = dataProvider;
        }

        for(GainListenerManager manager:gainListeners) {
            manager.send(gainExecutor, dataProvider, system);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.