Package org.archfirst.common.money

Examples of org.archfirst.common.money.Money$MismatchedCurrencyException


   
    private void performMatching(String symbol) {
        logger.debug("Pricing engine triggered for symbol {}", symbol);
        MarketPrice marketPrice =
            marketDataRepository.findMarketPrice(symbol);
        Money preMatchingPrice = marketPrice.getPrice();
        OrderBook orderBook = getOrderBook(symbol);

        // Iterate through buy orders
        for (Order buyOrder : orderBook.getBuyStack()) {
            logger.debug("Trying to match buy order:\n{}", buyOrder);
View Full Code Here


                executeOrders(buyOrder, sellOrder, buyOrder.getLimitPrice());
                marketPrice.change(buyOrder.getLimitPrice());
                matchResult = new MatchResult(true, null);
            }
            else // sell order is limit order
                Money buyPrice = buyOrder.getLimitPrice();
                Money sellPrice = sellOrder.getLimitPrice();
                if (buyPrice.compareTo(sellPrice) >= 0) {
                    Money executionPrice =
                        buyPrice.plus(sellPrice).div(2, Constants.PRICE_SCALE);
                    executeOrders(buyOrder, sellOrder, executionPrice);
                    marketPrice.change(executionPrice);
                    matchResult = new MatchResult(true, null);
                }
View Full Code Here

                properties.getProperty("price"));
        Currency currency = Currency.getInstance(
                properties.getProperty("currency"));

        return new MarketPrice(
                symbol, new Money(price, currency), effective);
    }
View Full Code Here

    }
   
    public void transferCash(String accountName1, String accountName2, BigDecimal amount) {
        this.baseAccountService.transferCash(
                USERNAME1,
                new Money(amount),
                getAccountId(accountName1),
                getAccountId(accountName2));
    }
View Full Code Here

    public void transferSecurities(String accountName1, String accountName2, String symbol, BigDecimal quantity) {
        this.baseAccountService.transferSecurities(
                USERNAME1,
                symbol,
                new DecimalQuantity(quantity),
                new Money(),
                getAccountId(accountName1),
                getAccountId(accountName2));
    }
View Full Code Here

        this.createExternalAccount1();
    }
   
    public void initSecurityPosition(String symbol, BigDecimal quantity) throws Exception {
       
        Money pricePerShare = new Money("10");
       
        this.baseAccountService.transferSecurities(
                USERNAME1, symbol, new DecimalQuantity(quantity), pricePerShare,
                externalAccount1Id, brokerageAccount1Id);
View Full Code Here

    public void setup() {
        eventRecorder.clear();
    }
   
    public void setupSymbol(String symbol) {
        marketDataService.createMarketPrice(symbol, new Money("10.00"));
    }
View Full Code Here

    public void setupSymbol(String symbol) {
        marketDataService.createMarketPrice(symbol, new Money("10.00"));
    }

    public void createMarketPrice(String symbol, String price) {
        marketDataService.createMarketPrice(symbol, new Money(price));
    }
View Full Code Here

            clientOrderId,
            OrderSide.valueOf(side),
            symbol,
            new DecimalQuantity(quantity),
            OrderType.valueOf(type),
            (StringUtils.isEmpty(limitPrice)) ? null : new Money(limitPrice),
            (StringUtils.equalsIgnoreCase(gtc, "Y")) ?
                    OrderTerm.GoodTilCanceled : OrderTerm.GoodForTheDay,
            (StringUtils.equalsIgnoreCase(allOrNone, "Y")) ? true : false);
       
        matchingEngine.placeOrder(order);
View Full Code Here

        this.createExternalAccount1();
    }
   
    public void initCashPosition(BigDecimal amount) throws Exception {
        this.baseAccountService.transferCash(
                USERNAME1, new Money(amount),
                externalAccount1Id, brokerageAccount1Id);
    }
View Full Code Here

TOP

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

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.