Package com.collective2.signalEntry.adapter

Examples of com.collective2.signalEntry.adapter.IterableXMLEventReader


        BigDecimal startingCash = new BigDecimal("1000.00");
        Portfolio portfolio = new SimplePortfolioFactory().createPortfolio(startingCash);

        int id = 42;
        long time = stop;
        Instrument instrument = Instrument.Forex;
        String symbol = "GG";
        SignalAction action = SignalAction.BTO;
        Integer quantity = 10;
        QuantityComputable quantityComputable = new QuantityComputableFixed(quantity);
        long cancelAtMs = Long.MAX_VALUE;
View Full Code Here


        BigDecimal startingCash = new BigDecimal("1000.00");
        Portfolio portfolio = new SimplePortfolioFactory().createPortfolio(startingCash);

        int id = 42;
        long time = stop;
        Instrument instrument = Instrument.Forex;
        String symbol = "GG";
        Integer quantity = 10;
        QuantityComputable quantityComputable = new QuantityComputableFixed(quantity);
        long cancelAtMs = Long.MAX_VALUE;
        Duration timeInForce = Duration.GoodTilCancel;
View Full Code Here

            msft = msft.limitOrder(triggerPrice);
        } else {
            msft = msft.stopOrder(triggerPrice);
        }

        Response openResponse = msft.send();

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

        assertEquals(0,signalId.intValue());


        simulationAdapter.tick(dataProvider,sentryService);
View Full Code Here

        C2ServiceFactory factory = new C2ServiceFactory(simulationAdapter);
        C2EntryService sentryService = factory.signalEntryService(password, systemId, eMail);

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

        Signal msft = sentryService.stockSignal(ActionForStock.BuyToOpen)
                .quantity(10).symbol("msft")
                .stopLoss(base, stopSize)
                .duration(Duration.GoodTilCancel);
        if (isLimit) {
            msft = msft.limitOrder(triggerPrice);
        } else {
            msft = msft.stopOrder(triggerPrice);
        }

        Response openResponse = msft.send();

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

        assertEquals(0,signalId.intValue());
View Full Code Here

        String password = "password";
        Integer systemId = 42;

        // simplest possible connection to collective2.com
        try {
            C2EntryServiceAdapter liveAdapter = new Collective2Adapter();
            C2ServiceFactory factory = new C2ServiceFactory(liveAdapter);
            C2EntryService entryService = factory.signalEntryService(password,systemId);
            assertNotNull(entryService);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

        // saves the requests to disk in case of unexpected shutdown while
        // retrying to transmit.
        try {
            C2EntryServiceJournal journal = new C2EntryServiceLogFileJournal(file, rollingLogLimit);

            C2EntryServiceAdapter liveAdapter = new Collective2Adapter();
            C2ServiceFactory factory = new C2ServiceFactory(liveAdapter, journal);
            C2EntryService entryService = factory.signalEntryService(password,systemId);
            assertNotNull(entryService);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

        // after .send() is called on signals the user will be prompted at the
        // console prompt for approval before transmission. The included class is just
        // an example and can be implemented with other GUI technologies.
        try {
            C2EntryServiceAdapter liveAdapter = new Collective2Adapter();
            C2EntryHumanApproval approval = new ApprovalRequestableConsole();
            C2ServiceFactory factory = new C2ServiceFactory(liveAdapter,approval);
            C2EntryService entryService = factory.signalEntryService(password,systemId);
            assertNotNull(entryService);
        } catch (Exception e) {
View Full Code Here

    @Test
    public void exampleServiceConstructionTest() {

        // validates commands and returns hard coded (canned) responses
        // for live production replace StaticSimulationAdapter with Collective2Adapter
        C2EntryServiceAdapter simulationAdapter = new StaticSimulationAdapter();
        C2ServiceFactory factory = new C2ServiceFactory(simulationAdapter);

        String password = "PA55WORD";
        Integer systemId = 99999999;
        String eMail = "someone@somewhere.com";
View Full Code Here

    @Test
    public void exampleServiceUsageTest() {
        // validates commands and returns hard coded (canned) responses
        // for live production replace StaticSimulationAdapter with Collective2Adapter
        C2EntryServiceAdapter simulationAdapter = new StaticSimulationAdapter();
        C2ServiceFactory factory = new C2ServiceFactory(simulationAdapter);

        String password = "PA55WORD";
        Integer systemId = 99999999;
        String eMail = "someone@somewhere.com";
View Full Code Here

    @Test
    public void exampleAsyncServiceUsageTest() {
        // validates commands and returns hard coded (canned) responses
        // for live production replace StaticSimulationAdapter with Collective2Adapter
        C2EntryServiceAdapter simulationAdapter = new StaticSimulationAdapter();
        C2ServiceFactory factory = new C2ServiceFactory(simulationAdapter);

        String password = "PA55WORD";
        Integer systemId = 99999999;
        String eMail = "someone@somewhere.com";
View Full Code Here

TOP

Related Classes of com.collective2.signalEntry.adapter.IterableXMLEventReader

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.