Package com.collective2.signalEntry.implementation

Examples of com.collective2.signalEntry.implementation.SignalAction


        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;
        Duration timeInForce = Duration.GoodTilCancel;
View Full Code Here


        assertEquals(Integer.valueOf(-quantity),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("-60"),portfolio.equity(dataProvider));

        //Buy to cover this short position

        SignalAction action = SignalAction.BTC;
        OrderProcessorStop buyProcessor = new OrderProcessorStop(time,symbol,buyBelow);
        order = new Order(null, id,instrument,symbol,action,quantityComputable,cancelAtMs,timeInForce,buyProcessor,null);

        processed = buyProcessor.process(dataProvider, portfolio, commission, order, action, quantityComputable, null);
        expectedCash = expectedCash.subtract(expectedBuy.multiply(new BigDecimal(quantity))).subtract(commission);
View Full Code Here

        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;
        Duration timeInForce = Duration.GoodTilCancel;
        OrderProcessorMarket processor = new OrderProcessorMarket(time, symbol);
View Full Code Here

        assertEquals(Integer.valueOf(-quantity),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("-60"),portfolio.equity(dataProvider));

        //Buy to cover this short position

        SignalAction action = SignalAction.BTC;
        order = new Order(null, id,instrument,symbol,action,quantityComputable,cancelAtMs,timeInForce,processor, null);

        processed = processor.process(dataProvider, portfolio, commission, order, action, quantityComputable, null);

        assertTrue(processed);
View Full Code Here

        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;
        Duration timeInForce = Duration.GoodTilCancel;
        OrderProcessorMarket processor = new OrderProcessorMarket(time, symbol);
View Full Code Here

        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;
        Duration timeInForce = Duration.GoodTilCancel;
View Full Code Here

        assertEquals(Integer.valueOf(-quantity),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("-60"),portfolio.equity(dataProvider));

        //Buy to cover this short position

        SignalAction action = SignalAction.BTC;
        OrderProcessorLimit buyProcessor = new OrderProcessorLimit(time,symbol,buyBelow);
        order = new Order(null, id,instrument,symbol,action,quantityComputable,cancelAtMs,timeInForce,buyProcessor,null);

        processed = buyProcessor.process(dataProvider, portfolio, commission, order, action, quantityComputable,null);
        expectedCash = expectedCash.subtract(expectedBuy.multiply(new BigDecimal(quantity))).subtract(commission);
View Full Code Here

                xmlEventReader = new SimulatedResponseSetMinBuyPower("OK");
                break;
            case SignalStatus:
                // return fixed values a real simulator could do better here
                // but, this is good enough for the unit tests
                SignalAction action = null;
                QuantityComputable quantityComputable = null;
                long cancelAtMs = Long.MAX_VALUE;
                Duration timeInForce = null;
                long time = System.currentTimeMillis();
                OrderProcessor processor = new OrderProcessorMarket(time,"WWW");
View Full Code Here

            }

            int id = (signalIdOnly << BITS_FOR_SYSTEM_ID)+systemId;

            String symbol = (String)request.get(Parameter.Symbol);
            SignalAction action = null;
            Order order = null;

            //reverse works like a macro. it does not do the processing but rather builds two
            //signal requests to reverse the order and calls schedule signal on each.
            if (request.command()== Command.Reverse) {
View Full Code Here

              <market>0</market>
              <tif>DAY</tif>
              <ocagroupid></ocagroupid>
            */
            if (showDetails) {
                SignalAction action = order.action();
                int quantity = order.quantity();
                String symbol = order.symbol();
                BigDecimal limit = order.limit(); //original signal value unless its relative in which case its not available
                BigDecimal stop = order.stop()//original signal value unless its relative in which case its not available
                BigDecimal market = order.market();
                Duration duration = order.timeInForce();
                Integer ocaGroupId = order.oneCancelsAnother();

                queue.add(eventFactory.createStartElement("", "", "action"));
                queue.add(eventFactory.createCharacters(action.toString()));
                queue.add(eventFactory.createEndElement("", "", "action"));

                queue.add(eventFactory.createStartElement("", "", "quant"));
                queue.add(eventFactory.createCharacters(Integer.toString(quantity)));
                queue.add(eventFactory.createEndElement("", "", "quant"));
View Full Code Here

TOP

Related Classes of com.collective2.signalEntry.implementation.SignalAction

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.