Package com.collective2.signalEntry.adapter

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


        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 startTime = time+timeStep;
        long closeTime = startTime+timeStep;
        BigDecimal closePrice = new BigDecimal("160.86");
        dataProvider = new DynamicSimulationMockDataProvider(startTime,fixedPrice,closePrice,fixedPrice,closePrice,closeTime);
        simulationAdapter.tick(dataProvider,sentryService);

        ////////////////////
        //confirm values
        ///////////////////
        assertEquals(0, portfolio.position("msft").quantity().intValue());
View Full Code Here

        ///////////////////////////
        //tick for limit order fail
        ////////////////////////////
        dataProvider = dataProvider.incTime(timeStep);
        simulationAdapter.tick(dataProvider,sentryService);

        ////////////////////
        //confirm unchanged values
        ///////////////////
        assertEquals(0, portfolio.position("msft").quantity().intValue());
View Full Code Here

        ///////////////////////////
        //tick for limit order success
        ////////////////////////////
        dataProvider = dataProvider.incTime(timeStep);
        simulationAdapter.tick(dataProvider,sentryService);

        ////////////////////
        //confirm changed
        ///////////////////
        BigDecimal entryPrice = portfolio.position("msft").openPrice();
View Full Code Here

        ///////////////////////////
        //tick for limit order fail
        ////////////////////////////
        dataProvider = dataProvider.incTime(timeStep);
        simulationAdapter.tick(dataProvider,sentryService);

        ////////////////////
        //confirm nothing changed
        ///////////////////
        entryPrice = portfolio.position("msft").openPrice();
View Full Code Here

        ///////////////////////////
        //tick for limit order success
        ////////////////////////////
        dataProvider = dataProvider.incTime(timeStep);
        simulationAdapter.tick(dataProvider,sentryService);

        shares = new BigDecimal("0");
        assertEquals(shares.intValue(), portfolio.position("msft").quantity().intValue());

        //extra simple methods
View Full Code Here

        //this however has the quantity because QuantityComputableFixed is used above
        assertEquals(Integer.valueOf(10),sentryService.sendSignalStatusRequest(newCloseSignalId,true).getInteger(C2Element.ElementQuant));

        //send tick data to force open position if its still in force
        dataProvider = dataProvider.incTime(timeStep,new BigDecimal("13"));
        simulationAdapter.tick(dataProvider,sentryService);

        updateSetWithPendingSignalIds(sentryService, pendingSignalIdSet);

        assertEquals(10, portfolio.position("msft").quantity().intValue());
View Full Code Here

        } else {
            assertEquals(1,pendingSignalIdSet.size());
        }

        dataProvider = dataProvider.incTime(timeStep,new BigDecimal("9"));
        simulationAdapter.tick(dataProvider,sentryService);
        assertEquals(0, portfolio.position("msft").quantity().intValue());

        //for oca orders the other order will get cancelled when the first is triggered.
        //for non oca orders there will be one closing order however it should not be valid
        //because its a close against something closed.
View Full Code Here

                .xReplace(profitTargetSignalId.intValue()).send();

        Integer newCloseSignalId = adjClose.getInteger(C2Element.ElementSignalId);

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

        //these tests do not work for DayOrders because all the signals have already expired
        if (timeInForce==Duration.GoodTilCancel) {
            assertEquals(10, portfolio.position("msft").quantity().intValue());
View Full Code Here

                assertEquals(2,pendingSignalIdSet.size());
            } else {
                assertEquals(1,pendingSignalIdSet.size());
            }
            dataProvider = dataProvider.incTime(timeStep,new BigDecimal("161"));
            simulationAdapter.tick(dataProvider,sentryService);
            assertEquals(0, portfolio.position("msft").quantity().intValue());

            //for oca orders the other order will get cancelled when the first is triggered.
            //for non oca orders there will be one closing order however it should not be valid
            //because its a close against something closed.
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.