Package com.collective2.signalEntry.adapter.dynamicSimulator.portfolio

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio


        stopBTOTest(buyBelow, sellAbove, expectedBuy, expectedSell);
    }

    @Test
    public void  stopBTOTestTopTop() {
        RelativeNumber buyBelow = new RelativeNumber("1");//must buy ABOVE this price
        RelativeNumber sellAbove = new RelativeNumber("7");//must sell BELOW this price

        BigDecimal expectedBuy = new BigDecimal("3");
        BigDecimal expectedSell = new BigDecimal("3");

        stopBTOTest(buyBelow, sellAbove, expectedBuy, expectedSell);
View Full Code Here


    }

    @Test
    public void  stopSTOTest() {

        RelativeNumber sellAbove = new RelativeNumber("3");//must sell BELOW this price
        RelativeNumber buyBelow = new RelativeNumber("4");//must buy ABOVE this price

        BigDecimal expectedSell = new BigDecimal("3");
        BigDecimal expectedBuy = new BigDecimal("4");

        stopShortTest(SignalAction.STO, sellAbove, buyBelow, expectedSell, expectedBuy);
View Full Code Here

    }

    @Test
    public void  stopSShortTest() {

        RelativeNumber sellAbove = new RelativeNumber("2");//must sell BELOW this price
        RelativeNumber buyBelow = new RelativeNumber("2");//must buy ABOVE this price

        BigDecimal expectedSell = new BigDecimal("2");
        BigDecimal expectedBuy = new BigDecimal("3");

        stopShortTest(SignalAction.SSHORT, sellAbove, buyBelow, expectedSell, expectedBuy);
View Full Code Here

    private final DataProvider dataProvider = new DynamicSimulationMockDataProvider(start,open,high,low,close,stop);
    private final BigDecimal commission = new BigDecimal("9");

    @Test
    public void  limitBTOTestOpenOpen() {
        RelativeNumber buyBelow = new RelativeNumber("4");//must buy below this price
        RelativeNumber sellAbove = new RelativeNumber("3");//must sell above this price

        BigDecimal expectedBuy = new BigDecimal("3");
        BigDecimal expectedSell = new BigDecimal("3");

        limitBTOTest(buyBelow, sellAbove, expectedBuy, expectedSell);
View Full Code Here

        limitBTOTest(buyBelow, sellAbove, expectedBuy, expectedSell);
    }

    @Test
    public void  limitBTOTestLimitLimit() {
        RelativeNumber buyBelow = new RelativeNumber("2");//must buy below this price
        RelativeNumber sellAbove = new RelativeNumber("4");//must sell above this price

        BigDecimal expectedBuy = new BigDecimal("2");
        BigDecimal expectedSell = new BigDecimal("4");

        limitBTOTest(buyBelow, sellAbove, expectedBuy, expectedSell);
View Full Code Here

        limitBTOTest(buyBelow, sellAbove, expectedBuy, expectedSell);
    }

    @Test
    public void  limitBTOTestTopTop() {
        RelativeNumber buyBelow = new RelativeNumber("1");//must buy below this price
        RelativeNumber sellAbove = new RelativeNumber("7");//must sell above this price

        BigDecimal expectedBuy = new BigDecimal("1");
        BigDecimal expectedSell = new BigDecimal("7");

        limitBTOTest(buyBelow, sellAbove, expectedBuy, expectedSell);
View Full Code Here

    }

    @Test
    public void  limitSTOTest() {

        RelativeNumber sellAbove = new RelativeNumber("3");//must sell above this price
        RelativeNumber buyBelow = new RelativeNumber("4");//must buy below this price

        BigDecimal expectedSell = new BigDecimal("3");
        BigDecimal expectedBuy = new BigDecimal("3");

        limitShortTest(SignalAction.STO, sellAbove, buyBelow, expectedSell, expectedBuy);
View Full Code Here

    }

    @Test
    public void  limitSShortTest() {

        RelativeNumber sellAbove = new RelativeNumber("4");//must sell above this price
        RelativeNumber buyBelow = new RelativeNumber("2");//must buy below this price

        BigDecimal expectedSell = new BigDecimal("4");
        BigDecimal expectedBuy = new BigDecimal("2");

        limitShortTest(SignalAction.SSHORT, sellAbove, buyBelow, expectedSell, expectedBuy);
View Full Code Here

        //starts out empty
        assertTrue(!journal.pending().hasNext());

        /////////////////////////
        //successful addition of one request
        Request request = new Request(Command.Signal);
        journal.append(request);

        //stop journal and force reload from disk
        journal.close();
        journal = new C2EntryServiceLogFileJournal(tempFile,4096);

        assertEquals(request, journal.pending().next());

        ///////////////////////////////
        //successful removal of one request
        journal.markSent(request);

        //stop journal and force reload from disk
        journal.close();
        journal = new C2EntryServiceLogFileJournal(tempFile,4096);

        assertTrue("check file:"+tempFile,!journal.pending().hasNext());

        //////////////////////////////////
        //successful addition of two requests in order
        Request request2 = new Request(Command.Cancel);
        assert(!request.equals(request2));
        journal.append(request);

        //stop journal and force reload from disk
        journal.close();
View Full Code Here

            e.printStackTrace();
            fail();
        }
        C2EntryServiceLogFileJournal journal = new C2EntryServiceLogFileJournal(tempFile,50);

        Request request = new Request(Command.Signal);
        Request request2 = new Request(Command.Cancel);

        journal.append(request);
        journal.markSent(request);

        assertFalse(journal.pending().hasNext());
View Full Code Here

TOP

Related Classes of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio

Copyright © 2018 www.massapicom. 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.