Package org.archfirst.common.money

Examples of org.archfirst.common.money.Money


                externalAccount1Id, brokerageAccount1Id);
    }
   
    public void setMarketPrice(String symbol, BigDecimal price) {
        marketDataService.updateMarketPrice(
                new MarketPrice(symbol, new Money(price), new DateTime()));
    }
View Full Code Here


        this.createExternalAccount1();
    }
   
    public List<Lot> transfer(String symbol, BigDecimal quantity) {
        this.baseAccountService.transferSecurities(
                USERNAME1, symbol, new DecimalQuantity(quantity), new Money(),
                externalAccount1Id, brokerageAccount1Id);
       
        List<Lot> lots =
            this.brokerageAccountService.findActiveLots(brokerageAccount1Id);
        Collections.sort(lots, new Lot.CreationTimeComparator());
View Full Code Here

        this.createUser1();
        this.createBrokerageAccount1();
        this.createExternalAccount1();

        this.baseAccountService.transferCash(
                USERNAME1, new Money("10000"),
                externalAccount1Id, brokerageAccount1Id);
    }
View Full Code Here

   
    public void initOrders(String symbol, int numOrders) {

        // Set a low market price so we have enough funds for buying shares
        marketDataService.updateMarketPrice(
                new MarketPrice(symbol, new Money("1.00"), new DateTime()));

        // Place orders
        for (int orderNumber=0; orderNumber < numOrders; orderNumber++) {
            OrderParams orderParams = new OrderParams(
                    OrderSide.Buy,
View Full Code Here

        }
        public DecimalQuantity getCumQty() {
            return executionReport.getCumQty();
        }
        public String getLastPrice() {
            Money lastPrice = executionReport.getLastPrice();
            return (lastPrice != null) ? lastPrice.getAmount().toString() : "";
        }
View Full Code Here

    }
   
    public void transferIn(String symbol, BigDecimal quantity, BigDecimal price) {
        this.baseAccountService.transferSecurities(
                USERNAME1, symbol,
                new DecimalQuantity(quantity), new Money(price),
                externalAccount1Id, brokerageAccount1Id);
    }
View Full Code Here

    public List<Lot> sell(String symbol, BigDecimal quantity) {
       
        // Make sure placeOrder() can get a market price for the symbol
        marketDataService.updateMarketPrice(
                new MarketPrice(symbol, new Money("10"), new DateTime()));

        // Place the order
        OrderParams orderParams = new OrderParams(
                OrderSide.Sell,
                symbol,
                quantity,
                OrderType.Market,
                null,
                OrderTerm.GoodTilCanceled,
                false);
        Long orderId = this.brokerageAccountService.placeOrder(
                USERNAME1, brokerageAccount1Id, orderParams);
        Order order = this.brokerageAccountService.findOrder(orderId);
       
        // Acknowledge the order
        ExecutionReport executionReport = ExecutionReport.createNewType(order);
        this.brokerageAccountService.processExecutionReport(executionReport);
       
        // Execute the trade
        executionReport = ExecutionReport.createTradeType(
                order,
                OrderStatus.Filled,
                new DecimalQuantity(quantity),
                new Money());
        this.brokerageAccountService.processExecutionReport(executionReport);
       
        List<Lot> lots =
            this.brokerageAccountService.findActiveLots(brokerageAccount1Id);
        Collections.sort(lots, new Lot.CreationTimeComparator());
View Full Code Here

        return (money == null) ? null : new org.archfirst.bfcommon.jsontrading.Money(
                money.getAmount(), money.getCurrency().toString());
    }
   
    public static Money toDomain(org.archfirst.bfcommon.jsontrading.Money money) {
        return (money == null) ? null : new Money(
                money.getAmount(),
                java.util.Currency.getInstance(money.getCurrency()));
    }
View Full Code Here

    }
   
    public void transferIn(String symbol, BigDecimal quantity, BigDecimal price) {
        this.baseAccountService.transferSecurities(
                USERNAME1, symbol,
                new DecimalQuantity(quantity), new Money(price),
                externalAccount1Id, brokerageAccount1Id);
    }
View Full Code Here

                externalAccount1Id, brokerageAccount1Id);
    }

    public List<Lot> transferOut(String symbol, BigDecimal quantity) {
        this.baseAccountService.transferSecurities(
                USERNAME1, symbol, new DecimalQuantity(quantity), new Money(),
                brokerageAccount1Id, externalAccount1Id);
       
        List<Lot> lots =
            this.brokerageAccountService.findActiveLots(brokerageAccount1Id);
        Collections.sort(lots, new Lot.CreationTimeComparator());
View Full Code Here

TOP

Related Classes of org.archfirst.common.money.Money

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.