Search in sources :

Example 1 with LgoProductCurrency

use of org.knowm.xchange.lgo.dto.product.LgoProductCurrency in project XChange by knowm.

the class LgoTradeService method verifyOrder.

@Override
public void verifyOrder(MarketOrder marketOrder) {
    LgoProduct product = getProduct(marketOrder.getCurrencyPair());
    LgoProductCurrency currencyToCheck = OrderType.BID.equals(marketOrder.getType()) ? product.getQuote() : product.getBase();
    if (currencyToCheck.getLimits().getMin().compareTo(marketOrder.getRemainingAmount()) > 0) {
        throw new IllegalArgumentException("Quantity to low");
    }
    if (currencyToCheck.getLimits().getMax().compareTo(marketOrder.getRemainingAmount()) < 0) {
        throw new IllegalArgumentException("Quantity to high");
    }
}
Also used : LgoProduct(org.knowm.xchange.lgo.dto.product.LgoProduct) LgoProductCurrency(org.knowm.xchange.lgo.dto.product.LgoProductCurrency)

Aggregations

LgoProduct (org.knowm.xchange.lgo.dto.product.LgoProduct)1 LgoProductCurrency (org.knowm.xchange.lgo.dto.product.LgoProductCurrency)1