Examples of cash()


Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

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

        assertTrue(processed);
        assertEquals("buy ",expectedBuy, buyProcessor.transactionPrice());
        assertEquals(expectedCash,portfolio.cash());
        assertEquals(Integer.valueOf(0),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("0"),portfolio.equity(dataProvider));

    }
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        //test only the processor and do it outside the order
        boolean processed = processor.process(dataProvider, portfolio, commission, order, action, quantityComputable, null);

        assertTrue(processed);
        assertEquals(new BigDecimal("961.00"),portfolio.cash());
        assertEquals(quantity,portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("60"),portfolio.equity(dataProvider));

        //sell to close this open position.
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        //test only the processor and do it outside the order
        processed = processor.process(dataProvider, portfolio, commission, order, action, quantityComputable, null);

        assertTrue(processed);
        assertEquals(new BigDecimal("982.00"),portfolio.cash());
        assertEquals(Integer.valueOf(0),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("0"),portfolio.equity(dataProvider));

    }
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        //test only the processor and do it outside the order
        boolean processed = processor.process(dataProvider, portfolio, commission, order, sellAction, quantityComputable, null);

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

        //Buy to cover this short position
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        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);
        assertEquals(new BigDecimal("982.00"),portfolio.cash());
        assertEquals(Integer.valueOf(0),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("0"),portfolio.equity(dataProvider));

    }
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        assertEquals(quantity, Integer.valueOf(buyOrder.quantity()));
        assertEquals(quantity, Integer.valueOf(sellOrder.quantity()));

        assertTrue(sellOrder.process(dataProvider, portfolio, commission,null));

        assertEquals(new BigDecimal("982.00"),portfolio.cash());
        assertEquals(Integer.valueOf(0),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("0"),portfolio.equity(dataProvider));

    }
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        assertTrue(processed);
        BigDecimal expectedCash = startingCash.subtract(expectedBuy.multiply(new BigDecimal(quantity)).add(commission));

        assertEquals(expectedBuy, processor.transactionPrice());
        assertEquals(expectedCash, portfolio.cash());
        assertEquals(quantity,portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("60"),portfolio.equity(dataProvider));

        //sell to close this open position.
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        assertTrue(processed);
        expectedCash = expectedCash.add(expectedSell.multiply(new BigDecimal(quantity))).subtract(commission);

        assertEquals(expectedSell, sellProcessor.transactionPrice());
        assertEquals(expectedCash,portfolio.cash());
        assertEquals(Integer.valueOf(0),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("0"),portfolio.equity(dataProvider));

    }
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

        BigDecimal expectedCash = startingCash.add(expectedSell.multiply(new BigDecimal(quantity)).subtract(commission));

        assertTrue(processed);
        assertEquals("sell ", expectedSell, processor.transactionPrice());
        assertEquals(expectedCash,portfolio.cash());
        assertEquals(Integer.valueOf(-quantity),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("-60"),portfolio.equity(dataProvider));

        //Buy to cover this short position
View Full Code Here

Examples of com.collective2.signalEntry.adapter.dynamicSimulator.portfolio.Portfolio.cash()

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

        assertTrue(processed);
        assertEquals("buy ",expectedBuy, buyProcessor.transactionPrice());
        assertEquals(expectedCash,portfolio.cash());
        assertEquals(Integer.valueOf(0),portfolio.position("GG").quantity());
        assertEquals(new BigDecimal("0"),portfolio.equity(dataProvider));

    }
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.