Package org.archfirst.bfoms.domain.marketdata

Examples of org.archfirst.bfoms.domain.marketdata.MarketPrice


    public void onMessage(Message message) {

        if (message instanceof TextMessage) {
            try {
                String messageText = ((TextMessage)message).getText();
                MarketPrice marketPrice = toMarketPrice(messageText);
                logger.debug("Received market price:\n{}", marketPrice);
                marketDataService.updateMarketPrice(marketPrice);
            }
            catch (JMSException e) {
                throw new RuntimeException(e);
View Full Code Here


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

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

   
    private List<MarketPrice> marketPrices =
        new ArrayList<MarketPrice>();

    public void addMarketPrice(String symbol, Money price) {
        marketPrices.add(new MarketPrice(symbol, price, new DateTime()));
    }
View Full Code Here

                USERNAME1, symbol, new DecimalQuantity(quantity), pricePerShare,
                externalAccount1Id, brokerageAccount1Id);

        // getOrderEstimate() requires a market price to calculate sale amount
        marketDataService.updateMarketPrice(
                new MarketPrice(symbol, pricePerShare, new DateTime()));
    }
View Full Code Here

                externalAccount1Id, brokerageAccount1Id);
    }
   
    public void setMarketPrice(String symbol, BigDecimal price) {
        marketDataService.updateMarketPrice(
                new MarketPrice(symbol, new Money(price), new DateTime()));
    }
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 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,
View Full Code Here

   
    public List<Lot> buy(String symbol, BigDecimal quantity, BigDecimal pricePaidPerShare) {
       
        // 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.Buy,
                symbol,
View Full Code Here

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

    }

    private static final MarketPrice toDomainMarketPrice(
            org.archfirst.bfoms.interfaceout.exchange.marketdataadapter.client.MarketPrice wsMarketPrice) {

        return new MarketPrice(
                wsMarketPrice.getSymbol(),
                new Money(
                        wsMarketPrice.getPrice().getAmount(),
                        Currency.getInstance(wsMarketPrice.getPrice().getCurrency())),
                new DateTime(wsMarketPrice.getEffective().toGregorianCalendar()));
View Full Code Here

TOP

Related Classes of org.archfirst.bfoms.domain.marketdata.MarketPrice

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.