Package org.archfirst.common.money

Examples of org.archfirst.common.money.Money


        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


    }
   
    @Transient
    public Money getWeightedAveragePriceOfExecutions() {
        if (executions.size() == 0) {
            return new Money("0.00");
        }

        // Calculate weighted average
        Money totalPrice = new Money("0.00");
        DecimalQuantity totalQuantity = new DecimalQuantity();
        for (Execution execution : executions) {
            totalPrice = totalPrice.plus(
                    execution.getPrice().times(execution.getQuantity()));
            totalQuantity = totalQuantity.plus(execution.getQuantity());
        }
        totalPrice = totalPrice.scaleToCurrency();
        return totalPrice.div(totalQuantity, Constants.PRICE_SCALE);
    }
View Full Code Here

        return new LastPx(money.getAmount().doubleValue());
    }

    public static Money toDomain(LastPx lastPx)
            throws FieldNotFound {
        return new Money(new BigDecimal(Double.toString(lastPx.getValue())));
    }
View Full Code Here

        return new AvgPx(money.getAmount().doubleValue());
    }
   
    public static Money toDomain(AvgPx avgPx)
            throws FieldNotFound {
        return new Money(new BigDecimal(Double.toString(avgPx.getValue())));
    }
View Full Code Here

        return new Currency(money.getCurrency().getCurrencyCode());
    }

    public static Money toDomain(Price price, Currency currency) {
        // Convert using string representation of double
        return new Money(
                new BigDecimal(Double.toString(price.getValue())),
                java.util.Currency.getInstance(currency.getValue()));
    }
View Full Code Here

        return new LastPx(money.getAmount().doubleValue());
    }
   
    public static Money toDomain(LastPx lastPx)
            throws FieldNotFound {
        return new Money(new BigDecimal(Double.toString(lastPx.getValue())));
    }
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.